Commit 22932d6b authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

Reland "[runtime] Slightly optimize creation of class literals."

Bug: v8:5799
Change-Id: I782ec131c7194aef20942a19750168a974913c3f
Reviewed-on: https://chromium-review.googlesource.com/757337
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49291}
parent b0996927
......@@ -1799,6 +1799,7 @@ v8_source_set("v8_base") {
"src/objects/js-array.h",
"src/objects/js-regexp-inl.h",
"src/objects/js-regexp.h",
"src/objects/literal-objects-inl.h",
"src/objects/literal-objects.cc",
"src/objects/literal-objects.h",
"src/objects/map-inl.h",
......
......@@ -828,6 +828,17 @@ bool Literal::IsPropertyName() const {
return !string_->AsArrayIndex(&index);
}
bool Literal::AsArrayIndex(uint32_t* index) const {
if (type() == kString) {
return string_->AsArrayIndex(index);
} else {
DCHECK_EQ(kSmi, type());
DCHECK_LE(0, smi_);
*index = smi_;
return true;
}
}
bool Literal::ToUint32(uint32_t* value) const {
switch (type()) {
case kSmi:
......
......@@ -1006,6 +1006,10 @@ class Literal final : public Expression {
// Returns true if literal represents a property name (i.e. cannot be parsed
// as array indices).
bool IsPropertyName() const;
// Returns true if literal represents an array index.
bool AsArrayIndex(uint32_t* index) const;
const AstRawString* AsRawPropertyName() {
DCHECK(IsPropertyName());
return string_;
......
......@@ -191,6 +191,7 @@ enum class ObjectType {
#undef ENUM_STRUCT_ELEMENT
class AccessCheckNeeded;
class ClassBoilerplate;
class CompilationCacheTable;
class Constructor;
class Filler;
......
......@@ -3115,6 +3115,7 @@ Handle<Map> Factory::CreateClassFunctionMap(Handle<JSFunction> empty_function) {
Handle<Map> map = NewMap(JS_FUNCTION_TYPE, JSFunction::kSizeWithPrototype);
map->set_has_prototype_slot(true);
map->set_is_constructor(true);
map->set_is_prototype_map(true);
map->set_is_callable();
Map::SetPrototype(map, empty_function);
......@@ -3123,8 +3124,8 @@ Handle<Map> Factory::CreateClassFunctionMap(Handle<JSFunction> empty_function) {
//
Map::EnsureDescriptorSlack(map, 2);
PropertyAttributes rw_attribs =
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
PropertyAttributes ro_attribs =
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
PropertyAttributes roc_attribs =
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
......@@ -3138,7 +3139,7 @@ Handle<Map> Factory::CreateClassFunctionMap(Handle<JSFunction> empty_function) {
{
// Add prototype accessor.
Descriptor d = Descriptor::AccessorConstant(
prototype_string(), function_prototype_accessor(), rw_attribs);
prototype_string(), function_prototype_accessor(), ro_attribs);
map->AppendDescriptor(&d);
}
return map;
......
......@@ -288,6 +288,7 @@ using v8::MemoryPressureLevel;
V(CatchContextMap) \
V(CellMap) \
V(CodeMap) \
V(DescriptorArrayMap) \
V(EmptyByteArray) \
V(EmptyDescriptorArray) \
V(EmptyFixedArray) \
......
This diff is collapsed.
......@@ -153,9 +153,6 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void VisitArgumentsObject(Variable* variable);
void VisitRestArgumentsArray(Variable* rest);
void VisitCallSuper(Call* call);
void VisitClassLiteralProperties(ClassLiteral* expr, Register constructor,
Register prototype);
void BuildClassLiteralNameProperty(ClassLiteral* expr, Register constructor);
void BuildClassLiteral(ClassLiteral* expr);
void VisitNewTargetVariable(Variable* variable);
void VisitThisFunctionVariable(Variable* variable);
......@@ -308,6 +305,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
native_function_literals_;
ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_;
ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_;
ZoneVector<std::pair<ClassLiteral*, size_t>> class_literals_;
ZoneVector<std::pair<GetTemplateObject*, size_t>> template_objects_;
ControlScope* execution_control_;
......
......@@ -152,6 +152,8 @@ bool HeapObject::IsJSGeneratorObject() const {
bool HeapObject::IsBoilerplateDescription() const { return IsFixedArray(); }
bool HeapObject::IsClassBoilerplate() const { return IsFixedArray(); }
bool HeapObject::IsExternal() const {
return map()->FindRootMap() == GetHeap()->external_map();
}
......
......@@ -1145,6 +1145,9 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
os << "<no-shared-name>";
}
os << "\n - kind = " << kind();
if (needs_home_object()) {
os << "\n - needs_home_object";
}
os << "\n - function_map_index = " << function_map_index();
os << "\n - formal_parameter_count = " << internal_formal_parameter_count();
os << "\n - expected_nof_properties = " << expected_nof_properties();
......
......@@ -15619,6 +15619,7 @@ template <typename Derived, typename Shape>
void Dictionary<Derived, Shape>::Print() {
OFStream os(stdout);
Print(os);
os << std::endl;
}
#endif
......@@ -17407,6 +17408,23 @@ Handle<Derived> Dictionary<Derived, Shape>::AtPut(Handle<Derived> dictionary,
return dictionary;
}
template <typename Derived, typename Shape>
Handle<Derived>
BaseNameDictionary<Derived, Shape>::AddNoUpdateNextEnumerationIndex(
Handle<Derived> dictionary, Key key, Handle<Object> value,
PropertyDetails details, int* entry_out) {
// Insert element at empty or deleted entry
return Dictionary<Derived, Shape>::Add(dictionary, key, value, details,
entry_out);
}
// GCC workaround: Explicitly instantiate template method for NameDictionary
// to avoid "undefined reference" issues during linking.
template Handle<NameDictionary>
BaseNameDictionary<NameDictionary, NameDictionaryShape>::
AddNoUpdateNextEnumerationIndex(Handle<NameDictionary>, Handle<Name>,
Handle<Object>, PropertyDetails, int*);
template <typename Derived, typename Shape>
Handle<Derived> BaseNameDictionary<Derived, Shape>::Add(
Handle<Derived> dictionary, Key key, Handle<Object> value,
......@@ -17418,7 +17436,7 @@ Handle<Derived> BaseNameDictionary<Derived, Shape>::Add(
int index = dictionary->NextEnumerationIndex();
details = details.set_index(index);
dictionary->SetNextEnumerationIndex(index + 1);
return Dictionary<Derived, Shape>::Add(dictionary, key, value, details,
return AddNoUpdateNextEnumerationIndex(dictionary, key, value, details,
entry_out);
}
......
......@@ -977,6 +977,7 @@ template <class C> inline bool Is(Object* obj);
V(Callable) \
V(CallHandlerInfo) \
V(Cell) \
V(ClassBoilerplate) \
V(Code) \
V(CodeDataContainer) \
V(CompilationCacheTable) \
......
......@@ -172,6 +172,10 @@ class BaseNameDictionary : public Dictionary<Derived, Shape> {
// Ensure enough space for n additional elements.
static Handle<Derived> EnsureCapacity(Handle<Derived> dictionary, int n);
MUST_USE_RESULT static Handle<Derived> AddNoUpdateNextEnumerationIndex(
Handle<Derived> dictionary, Key key, Handle<Object> value,
PropertyDetails details, int* entry_out = nullptr);
MUST_USE_RESULT static Handle<Derived> Add(Handle<Derived> dictionary,
Key key, Handle<Object> value,
PropertyDetails details,
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_LITERAL_OBJECTS_INL_H_
#define V8_LITERAL_OBJECTS_INL_H_
#include "src/objects-inl.h"
#include "src/objects/literal-objects.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
CAST_ACCESSOR(ClassBoilerplate)
BIT_FIELD_ACCESSORS(ClassBoilerplate, flags, install_class_name_accessor,
ClassBoilerplate::Flags::InstallClassNameAccessorBit)
BIT_FIELD_ACCESSORS(ClassBoilerplate, flags, arguments_count,
ClassBoilerplate::Flags::ArgumentsCountBits)
SMI_ACCESSORS(ClassBoilerplate, flags,
FixedArray::OffsetOfElementAt(kFlagsIndex));
ACCESSORS(ClassBoilerplate, static_properties_template, Object,
FixedArray::OffsetOfElementAt(kClassPropertiesTemplateIndex));
ACCESSORS(ClassBoilerplate, static_elements_template, Object,
FixedArray::OffsetOfElementAt(kClassElementsTemplateIndex));
ACCESSORS(ClassBoilerplate, static_computed_properties, FixedArray,
FixedArray::OffsetOfElementAt(kClassComputedPropertiesIndex));
ACCESSORS(ClassBoilerplate, instance_properties_template, Object,
FixedArray::OffsetOfElementAt(kPrototypePropertiesTemplateIndex));
ACCESSORS(ClassBoilerplate, instance_elements_template, Object,
FixedArray::OffsetOfElementAt(kPrototypeElementsTemplateIndex));
ACCESSORS(ClassBoilerplate, instance_computed_properties, FixedArray,
FixedArray::OffsetOfElementAt(kPrototypeComputedPropertiesIndex));
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_LITERAL_OBJECTS_INL_H_
This diff is collapsed.
......@@ -13,6 +13,8 @@
namespace v8 {
namespace internal {
class ClassLiteral;
// BoilerplateDescription is a list of properties consisting of name value
// pairs. In addition to the properties, it provides the projected number
// of properties in the backing store. This number includes properties with
......@@ -56,6 +58,79 @@ class ConstantElementsPair : public Tuple2 {
DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantElementsPair);
};
class ClassBoilerplate : public FixedArray {
public:
enum ValueKind { kData, kGetter, kSetter };
struct Flags {
#define FLAGS_BIT_FIELDS(V, _) \
V(InstallClassNameAccessorBit, bool, 1, _) \
V(ArgumentsCountBits, int, 30, _)
DEFINE_BIT_FIELDS(FLAGS_BIT_FIELDS)
#undef FLAGS_BIT_FIELDS
};
struct ComputedEntryFlags {
#define COMPUTED_ENTRY_BIT_FIELDS(V, _) \
V(ValueKindBits, ValueKind, 2, _) \
V(KeyIndexBits, unsigned, 29, _)
DEFINE_BIT_FIELDS(COMPUTED_ENTRY_BIT_FIELDS)
#undef COMPUTED_ENTRY_BIT_FIELDS
};
enum DefineClassArgumentsIndices {
kConstructorArgumentIndex = 1,
kPrototypeArgumentIndex = 2,
// The index of a first dynamic argument passed to Runtime::kDefineClass
// function. The dynamic arguments are consist of method closures and
// computed property names.
kFirstDynamicArgumentIndex = 3,
};
static const int kMinimumClassPropertiesCount = 6;
static const int kMinimumPrototypePropertiesCount = 1;
DECL_CAST(ClassBoilerplate)
DECL_BOOLEAN_ACCESSORS(install_class_name_accessor)
DECL_INT_ACCESSORS(arguments_count)
DECL_ACCESSORS(static_properties_template, Object)
DECL_ACCESSORS(static_elements_template, Object)
DECL_ACCESSORS(static_computed_properties, FixedArray)
DECL_ACCESSORS(instance_properties_template, Object)
DECL_ACCESSORS(instance_elements_template, Object)
DECL_ACCESSORS(instance_computed_properties, FixedArray)
static void AddToPropertiesTemplate(Isolate* isolate,
Handle<NameDictionary> dictionary,
Handle<Name> name, int key_index,
ValueKind value_kind, Object* value);
static void AddToElementsTemplate(Isolate* isolate,
Handle<NumberDictionary> dictionary,
uint32_t key, int key_index,
ValueKind value_kind, Object* value);
static Handle<ClassBoilerplate> BuildClassBoilerplate(Isolate* isolate,
ClassLiteral* expr);
enum {
kFlagsIndex,
kClassPropertiesTemplateIndex,
kClassElementsTemplateIndex,
kClassComputedPropertiesIndex,
kPrototypePropertiesTemplateIndex,
kPrototypeElementsTemplateIndex,
kPrototypeComputedPropertiesIndex,
kBoileplateLength // last element
};
static const int kFullComputedEntrySize = 2;
private:
DECL_INT_ACCESSORS(flags)
};
} // namespace internal
} // namespace v8
......
......@@ -496,16 +496,18 @@ class SharedFunctionInfo : public HeapObject {
DEFINE_BIT_FIELDS(DEBUGGER_HINTS_BIT_FIELDS)
#undef DEBUGGER_HINTS_BIT_FIELDS
// Indicates that this function uses a super property (or an eval that may
// use a super property).
// This is needed to set up the [[HomeObject]] on the function instance.
inline bool needs_home_object() const;
private:
// [raw_name]: Function name string or kNoSharedNameSentinel.
DECL_ACCESSORS(raw_name, Object)
inline void set_kind(FunctionKind kind);
// Indicates that this function uses a super property (or an eval that may
// use a super property).
// This is needed to set up the [[HomeObject]] on the function instance.
DECL_BOOLEAN_ACCESSORS(needs_home_object)
inline void set_needs_home_object(bool value);
friend class Factory;
friend class V8HeapExplorer;
......
This diff is collapsed.
......@@ -80,23 +80,21 @@ namespace internal {
F(BigIntToNumber, 1, 1) \
F(BigIntUnaryOp, 2, 1)
#define FOR_EACH_INTRINSIC_CLASSES(F) \
F(ThrowUnsupportedSuperError, 0, 1) \
F(ThrowConstructorNonCallableError, 1, 1) \
F(ThrowStaticPrototypeError, 0, 1) \
F(ThrowSuperAlreadyCalledError, 0, 1) \
F(ThrowSuperNotCalled, 0, 1) \
F(ThrowNotSuperConstructor, 2, 1) \
F(HomeObjectSymbol, 0, 1) \
F(DefineClass, 4, 1) \
F(InstallClassNameAccessor, 1, 1) \
F(InstallClassNameAccessorWithCheck, 1, 1) \
F(LoadFromSuper, 3, 1) \
F(LoadKeyedFromSuper, 3, 1) \
F(StoreToSuper_Strict, 4, 1) \
F(StoreToSuper_Sloppy, 4, 1) \
F(StoreKeyedToSuper_Strict, 4, 1) \
F(StoreKeyedToSuper_Sloppy, 4, 1) \
#define FOR_EACH_INTRINSIC_CLASSES(F) \
F(ThrowUnsupportedSuperError, 0, 1) \
F(ThrowConstructorNonCallableError, 1, 1) \
F(ThrowStaticPrototypeError, 0, 1) \
F(ThrowSuperAlreadyCalledError, 0, 1) \
F(ThrowSuperNotCalled, 0, 1) \
F(ThrowNotSuperConstructor, 2, 1) \
F(HomeObjectSymbol, 0, 1) \
F(DefineClass, -1 /* >= 3 */, 1) \
F(LoadFromSuper, 3, 1) \
F(LoadKeyedFromSuper, 3, 1) \
F(StoreToSuper_Strict, 4, 1) \
F(StoreToSuper_Sloppy, 4, 1) \
F(StoreKeyedToSuper_Strict, 4, 1) \
F(StoreKeyedToSuper_Sloppy, 4, 1) \
F(GetSuperConstructor, 1, 1)
#define FOR_EACH_INTRINSIC_COLLECTIONS(F) \
......
......@@ -1174,6 +1174,7 @@
'objects/js-regexp.h',
'objects/js-regexp-inl.h',
'objects/literal-objects.cc',
'objects/literal-objects-inl.h',
'objects/literal-objects.h',
'objects/map-inl.h',
'objects/map.h',
......
......@@ -12,40 +12,28 @@ snippet: "
speak() { console.log(this.name + ' is speaking.'); }
}
"
frame size: 8
frame size: 6
parameter count: 1
bytecode array length: 67
bytecode array length: 31
bytecodes: [
/* 30 E> */ B(StackCheck),
B(CreateClosure), U8(0), U8(0), U8(2),
B(Star), R(2),
B(LdaTheHole),
B(Star), R(4),
B(CreateClosure), U8(1), U8(0), U8(2),
B(Star), R(3),
B(LdaSmi), I8(34),
B(Star), R(5),
B(Wide), B(LdaSmi), I16(148),
B(Star), R(6),
B(Mov), R(2), R(4),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(LdaConstant), U8(1),
B(Star), R(5),
B(LdaConstant), U8(0),
B(Star), R(2),
B(CreateClosure), U8(2), U8(1), U8(2),
B(Star), R(6),
B(LdaSmi), I8(2),
B(Star), R(7),
B(Ldar), R(6),
B(StaDataPropertyInLiteral), R(3), R(5), U8(1), U8(2),
B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(2), U8(1),
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4),
B(Star), R(0),
B(Star), R(1),
B(LdaUndefined),
/* 149 S> */ B(Return),
]
constant pool: [
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["speak"],
SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
......@@ -58,40 +46,28 @@ snippet: "
speak() { console.log(this.name + ' is speaking.'); }
}
"
frame size: 8
frame size: 6
parameter count: 1
bytecode array length: 67
bytecode array length: 31
bytecodes: [
/* 30 E> */ B(StackCheck),
B(CreateClosure), U8(0), U8(0), U8(2),
B(Star), R(2),
B(LdaTheHole),
B(Star), R(4),
B(CreateClosure), U8(1), U8(0), U8(2),
B(Star), R(3),
B(LdaSmi), I8(34),
B(Star), R(5),
B(Wide), B(LdaSmi), I16(148),
B(Star), R(6),
B(Mov), R(2), R(4),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(LdaConstant), U8(1),
B(Star), R(5),
B(LdaConstant), U8(0),
B(Star), R(2),
B(CreateClosure), U8(2), U8(1), U8(2),
B(Star), R(6),
B(LdaSmi), I8(2),
B(Star), R(7),
B(Ldar), R(6),
B(StaDataPropertyInLiteral), R(3), R(5), U8(1), U8(2),
B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(2), U8(1),
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4),
B(Star), R(0),
B(Star), R(1),
B(LdaUndefined),
/* 149 S> */ B(Return),
]
constant pool: [
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["speak"],
SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
......@@ -106,9 +82,9 @@ snippet: "
static [n1]() { return n1; }
}
"
frame size: 9
frame size: 10
parameter count: 1
bytecode array length: 106
bytecode array length: 68
bytecodes: [
B(CreateFunctionContext), U8(2),
B(PushContext), R(2),
......@@ -117,36 +93,25 @@ bytecodes: [
/* 43 E> */ B(StaCurrentContextSlot), U8(4),
/* 57 S> */ B(LdaConstant), U8(1),
/* 57 E> */ B(StaCurrentContextSlot), U8(5),
B(CreateClosure), U8(2), U8(0), U8(2),
B(Star), R(3),
B(LdaTheHole),
B(Star), R(5),
B(CreateClosure), U8(3), U8(0), U8(2),
B(Star), R(4),
B(LdaSmi), I8(62),
B(Star), R(6),
B(Wide), B(LdaSmi), I16(128),
B(Star), R(7),
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
B(LdaConstant), U8(2),
B(Star), R(3),
B(LdaImmutableCurrentContextSlot), U8(4),
/* 75 E> */ B(ToName), R(6),
B(CreateClosure), U8(3), U8(1), U8(2),
B(CreateClosure), U8(4), U8(1), U8(2),
B(Star), R(7),
B(LdaSmi), I8(2),
B(Star), R(8),
B(Ldar), R(7),
B(StaDataPropertyInLiteral), R(4), R(6), U8(3), U8(2),
B(LdaImmutableCurrentContextSlot), U8(5),
/* 106 E> */ B(ToName), R(6),
B(LdaConstant), U8(4),
B(TestEqualStrictNoFeedback), R(6),
B(Mov), R(3), R(5),
/* 106 E> */ B(ToName), R(8),
B(LdaConstant), U8(5),
B(TestEqualStrictNoFeedback), R(8),
B(JumpIfFalse), U8(7),
B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0),
B(CreateClosure), U8(5), U8(4), U8(2),
B(StaDataPropertyInLiteral), R(5), R(6), U8(3), U8(5),
B(CallRuntime), U16(Runtime::kInstallClassNameAccessorWithCheck), R(3), U8(1),
B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1),
B(CreateClosure), U8(6), U8(2), U8(2),
B(Star), R(9),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(7),
B(Star), R(0),
B(Star), R(1),
B(LdaUndefined),
......@@ -155,6 +120,7 @@ bytecodes: [
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
SHARED_FUNCTION_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"],
......@@ -169,34 +135,29 @@ snippet: "
class C { constructor() { count++; }}
return new C();
"
frame size: 8
frame size: 6
parameter count: 1
bytecode array length: 55
bytecode array length: 36
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(2),
/* 30 E> */ B(StackCheck),
/* 46 S> */ B(LdaZero),
/* 46 E> */ B(StaCurrentContextSlot), U8(4),
B(CreateClosure), U8(0), U8(0), U8(2),
B(Star), R(3),
B(LdaTheHole),
B(Star), R(5),
B(CreateClosure), U8(1), U8(0), U8(2),
B(Star), R(4),
B(LdaSmi), I8(49),
B(Star), R(6),
B(LdaSmi), I8(86),
B(Star), R(7),
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(3), U8(1),
B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1),
B(LdaConstant), U8(0),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3),
B(Star), R(0),
B(Star), R(1),
/* 94 S> */ B(Construct), R(1), R(0), U8(0), U8(1),
/* 102 S> */ B(Return),
]
constant pool: [
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
......@@ -207,52 +168,37 @@ snippet: "
(class {})
class E { static name () {}}
"
frame size: 8
frame size: 6
parameter count: 1
bytecode array length: 92
bytecode array length: 49
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 34 S> */ B(CreateClosure), U8(0), U8(0), U8(2),
B(Star), R(2),
B(LdaTheHole),
B(Star), R(3),
B(LdaSmi), I8(35),
B(Star), R(5),
B(LdaSmi), I8(43),
B(Star), R(6),
B(Mov), R(2), R(4),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
/* 34 S> */ B(LdaTheHole),
B(Star), R(4),
B(CreateClosure), U8(1), U8(0), U8(2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(CreateClosure), U8(1), U8(1), U8(2),
B(LdaConstant), U8(0),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(3),
B(LdaTheHole),
B(Star), R(3),
B(LdaSmi), I8(45),
B(Star), R(5),
B(LdaSmi), I8(73),
B(Star), R(6),
B(Mov), R(2), R(4),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(4),
B(CreateClosure), U8(3), U8(1), U8(2),
B(Star), R(3),
B(LdaConstant), U8(2),
B(Star), R(2),
B(CreateClosure), U8(4), U8(2), U8(2),
B(Star), R(5),
B(CreateClosure), U8(3), U8(2), U8(2),
B(Star), R(6),
B(LdaSmi), I8(2),
B(Star), R(7),
B(Ldar), R(6),
B(StaDataPropertyInLiteral), R(4), R(5), U8(1), U8(3),
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4),
B(Star), R(0),
B(Star), R(1),
B(LdaUndefined),
/* 74 S> */ B(Return),
]
constant pool: [
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"],
SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
......
......@@ -505,9 +505,9 @@ handlers: [
snippet: "
export default (class {});
"
frame size: 8
frame size: 6
parameter count: 2
bytecode array length: 140
bytecode array length: 121
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(18),
......@@ -548,19 +548,13 @@ bytecodes: [
/* 26 S> */ B(Return),
B(Ldar), R(3),
B(StaCurrentContextSlot), U8(5),
B(CreateClosure), U8(4), U8(0), U8(0),
B(Star), R(3),
B(LdaTheHole),
B(Star), R(5),
B(CreateClosure), U8(5), U8(0), U8(0),
B(Star), R(4),
B(LdaSmi), I8(16),
B(Star), R(6),
B(LdaSmi), I8(24),
B(Star), R(7),
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(3), U8(1),
B(CallRuntime), U16(Runtime::kToFastProperties), R(3), U8(1),
B(LdaConstant), U8(4),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(3),
B(StaModuleVariable), I8(1), U8(0),
B(LdaCurrentContextSlot), U8(5),
/* 26 S> */ B(Return),
......@@ -570,6 +564,7 @@ constant pool: [
FIXED_ARRAY_TYPE,
Smi [10],
Smi [7],
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
......
......@@ -10,27 +10,21 @@ snippet: "
class A { constructor(...args) { this.args = args; } }
new A(...[1, 2, 3]);
"
frame size: 7
frame size: 5
parameter count: 1
bytecode array length: 57
bytecode array length: 38
bytecodes: [
/* 30 E> */ B(StackCheck),
B(CreateClosure), U8(0), U8(0), U8(2),
B(Star), R(2),
B(LdaTheHole),
B(Star), R(4),
B(CreateClosure), U8(1), U8(0), U8(2),
B(Star), R(3),
B(LdaSmi), I8(34),
B(Star), R(5),
B(LdaSmi), I8(88),
B(Star), R(6),
B(Mov), R(2), R(4),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(2), U8(1),
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(LdaConstant), U8(0),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(3),
B(Star), R(0),
B(Star), R(1),
/* 89 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
/* 89 S> */ B(CreateArrayLiteral), U8(2), U8(1), U8(37),
B(Star), R(3),
B(Ldar), R(1),
/* 89 E> */ B(ConstructWithSpread), R(1), R(3), U8(1), U8(2),
......@@ -38,6 +32,7 @@ bytecodes: [
/* 110 S> */ B(Return),
]
constant pool: [
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
TUPLE2_TYPE,
]
......@@ -49,29 +44,23 @@ snippet: "
class A { constructor(...args) { this.args = args; } }
new A(0, ...[1, 2, 3]);
"
frame size: 7
frame size: 5
parameter count: 1
bytecode array length: 60
bytecode array length: 41
bytecodes: [
/* 30 E> */ B(StackCheck),
B(CreateClosure), U8(0), U8(0), U8(2),
B(Star), R(2),
B(LdaTheHole),
B(Star), R(4),
B(CreateClosure), U8(1), U8(0), U8(2),
B(Star), R(3),
B(LdaSmi), I8(34),
B(Star), R(5),
B(LdaSmi), I8(88),
B(Star), R(6),
B(Mov), R(2), R(4),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(2), U8(1),
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(LdaConstant), U8(0),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(3),
B(Star), R(0),
B(Star), R(1),
/* 89 S> */ B(LdaZero),
B(Star), R(3),
B(CreateArrayLiteral), U8(1), U8(1), U8(37),
B(CreateArrayLiteral), U8(2), U8(1), U8(37),
B(Star), R(4),
B(Ldar), R(1),
/* 89 E> */ B(ConstructWithSpread), R(1), R(3), U8(2), U8(2),
......@@ -79,6 +68,7 @@ bytecodes: [
/* 113 S> */ B(Return),
]
constant pool: [
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
TUPLE2_TYPE,
]
......@@ -90,33 +80,27 @@ snippet: "
class A { constructor(...args) { this.args = args; } }
new A(0, ...[1, 2, 3], 4);
"
frame size: 7
frame size: 6
parameter count: 1
bytecode array length: 81
bytecode array length: 62
bytecodes: [
/* 30 E> */ B(StackCheck),
B(CreateClosure), U8(0), U8(0), U8(2),
B(Star), R(2),
B(LdaTheHole),
B(Star), R(4),
B(CreateClosure), U8(1), U8(0), U8(2),
B(Star), R(3),
B(LdaSmi), I8(34),
B(Star), R(5),
B(LdaSmi), I8(88),
B(Star), R(6),
B(Mov), R(2), R(4),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kInstallClassNameAccessor), R(2), U8(1),
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(LdaConstant), U8(0),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(3),
B(Star), R(0),
B(Star), R(1),
/* 89 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
/* 89 S> */ B(CreateArrayLiteral), U8(2), U8(1), U8(37),
B(Star), R(3),
B(CreateArrayLiteral), U8(2), U8(2), U8(37),
B(CreateArrayLiteral), U8(3), U8(2), U8(37),
B(Star), R(4),
B(CallJSRuntime), U8(%spread_iterable), R(4), U8(1),
B(Star), R(4),
B(CreateArrayLiteral), U8(3), U8(3), U8(37),
B(CreateArrayLiteral), U8(4), U8(3), U8(37),
B(Star), R(5),
B(CallJSRuntime), U8(%spread_arguments), R(3), U8(3),
B(Star), R(3),
......@@ -126,6 +110,7 @@ bytecodes: [
/* 116 S> */ B(Return),
]
constant pool: [
FIXED_ARRAY_TYPE,
SHARED_FUNCTION_INFO_TYPE,
TUPLE2_TYPE,
TUPLE2_TYPE,
......
......@@ -199,58 +199,58 @@ KNOWN_MAPS = {
0x02cf1: (171, "BlockContextMap"),
0x02d41: (171, "CatchContextMap"),
0x02d91: (171, "WithContextMap"),
0x02de1: (148, "FixedDoubleArrayMap"),
0x02e31: (134, "MutableHeapNumberMap"),
0x02e81: (172, "OrderedHashTableMap"),
0x02ed1: (172, "NameDictionaryMap"),
0x02f21: (172, "GlobalDictionaryMap"),
0x02f71: (172, "NumberDictionaryMap"),
0x02fc1: (171, "SloppyArgumentsElementsMap"),
0x03011: (180, "SmallOrderedHashMapMap"),
0x03061: (181, "SmallOrderedHashSetMap"),
0x030b1: (189, "JSMessageObjectMap"),
0x03101: (137, "BytecodeArrayMap"),
0x03151: (171, "ModuleInfoMap"),
0x031a1: (177, "NoClosuresCellMap"),
0x031f1: (177, "OneClosureCellMap"),
0x03241: (177, "ManyClosuresCellMap"),
0x03291: (175, "PropertyArrayMap"),
0x032e1: (130, "BigIntMap"),
0x03331: (64, "StringMap"),
0x03381: (73, "ConsOneByteStringMap"),
0x033d1: (65, "ConsStringMap"),
0x03421: (77, "ThinOneByteStringMap"),
0x03471: (69, "ThinStringMap"),
0x034c1: (67, "SlicedStringMap"),
0x03511: (75, "SlicedOneByteStringMap"),
0x03561: (66, "ExternalStringMap"),
0x035b1: (82, "ExternalStringWithOneByteDataMap"),
0x03601: (74, "ExternalOneByteStringMap"),
0x03651: (98, "ShortExternalStringMap"),
0x036a1: (114, "ShortExternalStringWithOneByteDataMap"),
0x036f1: (0, "InternalizedStringMap"),
0x03741: (2, "ExternalInternalizedStringMap"),
0x03791: (18, "ExternalInternalizedStringWithOneByteDataMap"),
0x037e1: (10, "ExternalOneByteInternalizedStringMap"),
0x03831: (34, "ShortExternalInternalizedStringMap"),
0x03881: (50, "ShortExternalInternalizedStringWithOneByteDataMap"),
0x038d1: (42, "ShortExternalOneByteInternalizedStringMap"),
0x03921: (106, "ShortExternalOneByteStringMap"),
0x03971: (140, "FixedUint8ArrayMap"),
0x039c1: (139, "FixedInt8ArrayMap"),
0x03a11: (142, "FixedUint16ArrayMap"),
0x03a61: (141, "FixedInt16ArrayMap"),
0x03ab1: (144, "FixedUint32ArrayMap"),
0x03b01: (143, "FixedInt32ArrayMap"),
0x03b51: (145, "FixedFloat32ArrayMap"),
0x03ba1: (146, "FixedFloat64ArrayMap"),
0x03bf1: (147, "FixedUint8ClampedArrayMap"),
0x03c41: (158, "ScriptMap"),
0x03c91: (182, "CodeDataContainerMap"),
0x03ce1: (173, "FeedbackVectorMap"),
0x03d31: (171, "DebugEvaluateContextMap"),
0x03d81: (171, "ScriptContextTableMap"),
0x03dd1: (171, "DescriptorArrayMap"),
0x02de1: (171, "DescriptorArrayMap"),
0x02e31: (148, "FixedDoubleArrayMap"),
0x02e81: (134, "MutableHeapNumberMap"),
0x02ed1: (172, "OrderedHashTableMap"),
0x02f21: (172, "NameDictionaryMap"),
0x02f71: (172, "GlobalDictionaryMap"),
0x02fc1: (172, "NumberDictionaryMap"),
0x03011: (171, "SloppyArgumentsElementsMap"),
0x03061: (180, "SmallOrderedHashMapMap"),
0x030b1: (181, "SmallOrderedHashSetMap"),
0x03101: (189, "JSMessageObjectMap"),
0x03151: (137, "BytecodeArrayMap"),
0x031a1: (171, "ModuleInfoMap"),
0x031f1: (177, "NoClosuresCellMap"),
0x03241: (177, "OneClosureCellMap"),
0x03291: (177, "ManyClosuresCellMap"),
0x032e1: (175, "PropertyArrayMap"),
0x03331: (130, "BigIntMap"),
0x03381: (64, "StringMap"),
0x033d1: (73, "ConsOneByteStringMap"),
0x03421: (65, "ConsStringMap"),
0x03471: (77, "ThinOneByteStringMap"),
0x034c1: (69, "ThinStringMap"),
0x03511: (67, "SlicedStringMap"),
0x03561: (75, "SlicedOneByteStringMap"),
0x035b1: (66, "ExternalStringMap"),
0x03601: (82, "ExternalStringWithOneByteDataMap"),
0x03651: (74, "ExternalOneByteStringMap"),
0x036a1: (98, "ShortExternalStringMap"),
0x036f1: (114, "ShortExternalStringWithOneByteDataMap"),
0x03741: (0, "InternalizedStringMap"),
0x03791: (2, "ExternalInternalizedStringMap"),
0x037e1: (18, "ExternalInternalizedStringWithOneByteDataMap"),
0x03831: (10, "ExternalOneByteInternalizedStringMap"),
0x03881: (34, "ShortExternalInternalizedStringMap"),
0x038d1: (50, "ShortExternalInternalizedStringWithOneByteDataMap"),
0x03921: (42, "ShortExternalOneByteInternalizedStringMap"),
0x03971: (106, "ShortExternalOneByteStringMap"),
0x039c1: (140, "FixedUint8ArrayMap"),
0x03a11: (139, "FixedInt8ArrayMap"),
0x03a61: (142, "FixedUint16ArrayMap"),
0x03ab1: (141, "FixedInt16ArrayMap"),
0x03b01: (144, "FixedUint32ArrayMap"),
0x03b51: (143, "FixedInt32ArrayMap"),
0x03ba1: (145, "FixedFloat32ArrayMap"),
0x03bf1: (146, "FixedFloat64ArrayMap"),
0x03c41: (147, "FixedUint8ClampedArrayMap"),
0x03c91: (158, "ScriptMap"),
0x03ce1: (182, "CodeDataContainerMap"),
0x03d31: (173, "FeedbackVectorMap"),
0x03d81: (171, "DebugEvaluateContextMap"),
0x03dd1: (171, "ScriptContextTableMap"),
0x03e21: (192, "ExternalMap"),
0x03e71: (106, "NativeSourceStringMap"),
0x03ec1: (165, "Tuple2Map"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment