Chromium Code Reviews| Index: src/code-stub-assembler.cc |
| diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc |
| index 1a1ce3944396390e35c23fdf530f27bff9f656d5..6a1641ea91890478f85355705dd808fab120da77 100644 |
| --- a/src/code-stub-assembler.cc |
| +++ b/src/code-stub-assembler.cc |
| @@ -7816,6 +7816,26 @@ compiler::Node* CodeStubAssembler::Typeof(compiler::Node* value, |
| return result_var.value(); |
| } |
| +compiler::Node* CodeStubAssembler::GetSuperConstructor( |
| + compiler::Node* active_function, compiler::Node* context) { |
| + Node* map = LoadMap(active_function); |
|
caitp
2016/11/21 13:52:53
I would add a CSA_ASSERT() to ensure that this is
Benedikt Meurer
2016/11/23 04:51:00
Yes, please.
Henrique Ferreiro
2016/12/01 12:22:22
Similar code checks for a Smi and a HeapNumber, is
|
| + Node* prototype = LoadMapPrototype(map); |
| + Node* bit_field = LoadMapBitField(map); |
| + |
| + Label not_constructor(this); |
|
caitp
2016/11/21 13:52:53
You want this label to be deferred.
Henrique Ferreiro
2016/12/01 12:22:22
Would you mind explaining what is that for?
|
| + GotoUnless( |
| + Word32Equal(Word32And(bit_field, Int32Constant(1 << Map::kIsConstructor)), |
| + Int32Constant(1 << Map::kIsConstructor)), |
| + ¬_constructor); |
| + return prototype; |
| + |
| + Bind(¬_constructor); |
| + { |
| + CallRuntime(Runtime::kThrowConstructedNonConstructable, active_function); |
| + return UndefinedConstant(); // Never reached. |
| + } |
| +} |
| + |
| compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object, |
| compiler::Node* callable, |
| compiler::Node* context) { |