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

Side by Side 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 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/handler-configuration.h" 9 #include "src/ic/handler-configuration.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 7798 matching lines...) Expand 10 before | Expand all | Expand 10 after
7809 result_var.Bind(HeapConstant(isolate()->factory()->type##_string())); \ 7809 result_var.Bind(HeapConstant(isolate()->factory()->type##_string())); \
7810 Goto(&return_result); \ 7810 Goto(&return_result); \
7811 } 7811 }
7812 SIMD128_TYPES(SIMD128_BIND_RETURN) 7812 SIMD128_TYPES(SIMD128_BIND_RETURN)
7813 #undef SIMD128_BIND_RETURN 7813 #undef SIMD128_BIND_RETURN
7814 7814
7815 Bind(&return_result); 7815 Bind(&return_result);
7816 return result_var.value(); 7816 return result_var.value();
7817 } 7817 }
7818 7818
7819 compiler::Node* CodeStubAssembler::GetSuperConstructor(
7820 compiler::Node* active_function, compiler::Node* context) {
7821 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
7822 Node* prototype = LoadMapPrototype(map);
7823 Node* bit_field = LoadMapBitField(map);
7824
7825 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?
7826 GotoUnless(
7827 Word32Equal(Word32And(bit_field, Int32Constant(1 << Map::kIsConstructor)),
7828 Int32Constant(1 << Map::kIsConstructor)),
7829 &not_constructor);
7830 return prototype;
7831
7832 Bind(&not_constructor);
7833 {
7834 CallRuntime(Runtime::kThrowConstructedNonConstructable, active_function);
7835 return UndefinedConstant(); // Never reached.
7836 }
7837 }
7838
7819 compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object, 7839 compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object,
7820 compiler::Node* callable, 7840 compiler::Node* callable,
7821 compiler::Node* context) { 7841 compiler::Node* context) {
7822 Label return_runtime(this, Label::kDeferred), end(this); 7842 Label return_runtime(this, Label::kDeferred), end(this);
7823 Variable result(this, MachineRepresentation::kTagged); 7843 Variable result(this, MachineRepresentation::kTagged);
7824 7844
7825 // Check if no one installed @@hasInstance somewhere. 7845 // Check if no one installed @@hasInstance somewhere.
7826 GotoUnless( 7846 GotoUnless(
7827 WordEqual(LoadObjectField(LoadRoot(Heap::kHasInstanceProtectorRootIndex), 7847 WordEqual(LoadObjectField(LoadRoot(Heap::kHasInstanceProtectorRootIndex),
7828 PropertyCell::kValueOffset), 7848 PropertyCell::kValueOffset),
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
8068 Node* buffer_bit_field = LoadObjectField( 8088 Node* buffer_bit_field = LoadObjectField(
8069 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); 8089 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32());
8070 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); 8090 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask);
8071 8091
8072 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), 8092 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask),
8073 Int32Constant(0)); 8093 Int32Constant(0));
8074 } 8094 }
8075 8095
8076 } // namespace internal 8096 } // namespace internal
8077 } // namespace v8 8097 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698