| Index: src/code-stub-assembler.cc
|
| diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
|
| index e67f81f8e1ad28afb5ac25e2ac682167e964a484..dd20d44c3f03cf26af78797eee46a1bfd5f5e49a 100644
|
| --- a/src/code-stub-assembler.cc
|
| +++ b/src/code-stub-assembler.cc
|
| @@ -2856,6 +2856,13 @@ Node* CodeStubAssembler::IsCallableMap(Node* map) {
|
| Int32Constant(0));
|
| }
|
|
|
| +Node* CodeStubAssembler::IsConstructorMap(Node* map) {
|
| + CSA_ASSERT(this, IsMap(map));
|
| + return Word32NotEqual(
|
| + Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsConstructor)),
|
| + Int32Constant(0));
|
| +}
|
| +
|
| Node* CodeStubAssembler::IsSpecialReceiverInstanceType(Node* instance_type) {
|
| STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE);
|
| return Int32LessThanOrEqual(instance_type,
|
| @@ -2936,6 +2943,10 @@ Node* CodeStubAssembler::IsUnseededNumberDictionary(Node* object) {
|
| LoadRoot(Heap::kUnseededNumberDictionaryMapRootIndex));
|
| }
|
|
|
| +Node* CodeStubAssembler::IsJSFunction(Node* object) {
|
| + return HasInstanceType(object, JS_FUNCTION_TYPE);
|
| +}
|
| +
|
| Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index) {
|
| CSA_ASSERT(this, IsString(string));
|
| // Translate the {index} into a Word.
|
| @@ -7805,6 +7816,32 @@ Node* CodeStubAssembler::Typeof(Node* value, Node* context) {
|
| return result_var.value();
|
| }
|
|
|
| +Node* CodeStubAssembler::GetSuperConstructor(Node* active_function,
|
| + Node* context) {
|
| + CSA_ASSERT(this, IsJSFunction(active_function));
|
| +
|
| + Label is_not_constructor(this, Label::kDeferred), out(this);
|
| + Variable result(this, MachineRepresentation::kTagged);
|
| +
|
| + Node* map = LoadMap(active_function);
|
| + Node* prototype = LoadMapPrototype(map);
|
| + Node* prototype_map = LoadMap(prototype);
|
| + GotoUnless(IsConstructorMap(prototype_map), &is_not_constructor);
|
| +
|
| + result.Bind(prototype);
|
| + Goto(&out);
|
| +
|
| + Bind(&is_not_constructor);
|
| + {
|
| + result.Bind(CallRuntime(Runtime::kThrowNotSuperConstructor, context,
|
| + prototype, active_function));
|
| + Goto(&out);
|
| + }
|
| +
|
| + Bind(&out);
|
| + return result.value();
|
| +}
|
| +
|
| Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable,
|
| Node* context) {
|
| Label return_runtime(this, Label::kDeferred), end(this);
|
|
|