Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: src/code-stub-assembler.cc

Issue 2504553003: [es6] Perform the IsConstructor test in GetSuperConstructor. (Closed)
Patch Set: Convert GetSuperConstructor to a new interpreter bytecode Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)),
+ &not_constructor);
+ return prototype;
+
+ Bind(&not_constructor);
+ {
+ CallRuntime(Runtime::kThrowConstructedNonConstructable, active_function);
+ return UndefinedConstant(); // Never reached.
+ }
+}
+
compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object,
compiler::Node* callable,
compiler::Node* context) {

Powered by Google App Engine
This is Rietveld 408576698