Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2873 Int32Constant(0)); | 2873 Int32Constant(0)); |
| 2874 } | 2874 } |
| 2875 | 2875 |
| 2876 Node* CodeStubAssembler::IsCallableMap(Node* map) { | 2876 Node* CodeStubAssembler::IsCallableMap(Node* map) { |
| 2877 CSA_ASSERT(this, IsMap(map)); | 2877 CSA_ASSERT(this, IsMap(map)); |
| 2878 return Word32NotEqual( | 2878 return Word32NotEqual( |
| 2879 Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsCallable)), | 2879 Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsCallable)), |
| 2880 Int32Constant(0)); | 2880 Int32Constant(0)); |
| 2881 } | 2881 } |
| 2882 | 2882 |
| 2883 Node* CodeStubAssembler::IsConstructorMap(Node* map) { | |
| 2884 CSA_ASSERT(this, IsMap(map)); | |
| 2885 return Word32NotEqual( | |
| 2886 Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsConstructor)), | |
| 2887 Int32Constant(0)); | |
| 2888 } | |
| 2889 | |
| 2883 Node* CodeStubAssembler::IsSpecialReceiverInstanceType(Node* instance_type) { | 2890 Node* CodeStubAssembler::IsSpecialReceiverInstanceType(Node* instance_type) { |
| 2884 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); | 2891 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); |
| 2885 return Int32LessThanOrEqual(instance_type, | 2892 return Int32LessThanOrEqual(instance_type, |
| 2886 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)); | 2893 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)); |
| 2887 } | 2894 } |
| 2888 | 2895 |
| 2889 Node* CodeStubAssembler::IsStringInstanceType(Node* instance_type) { | 2896 Node* CodeStubAssembler::IsStringInstanceType(Node* instance_type) { |
| 2890 STATIC_ASSERT(INTERNALIZED_STRING_TYPE == FIRST_TYPE); | 2897 STATIC_ASSERT(INTERNALIZED_STRING_TYPE == FIRST_TYPE); |
| 2891 return Int32LessThan(instance_type, Int32Constant(FIRST_NONSTRING_TYPE)); | 2898 return Int32LessThan(instance_type, Int32Constant(FIRST_NONSTRING_TYPE)); |
| 2892 } | 2899 } |
| (...skipping 4918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7811 result_var.Bind(HeapConstant(isolate()->factory()->type##_string())); \ | 7818 result_var.Bind(HeapConstant(isolate()->factory()->type##_string())); \ |
| 7812 Goto(&return_result); \ | 7819 Goto(&return_result); \ |
| 7813 } | 7820 } |
| 7814 SIMD128_TYPES(SIMD128_BIND_RETURN) | 7821 SIMD128_TYPES(SIMD128_BIND_RETURN) |
| 7815 #undef SIMD128_BIND_RETURN | 7822 #undef SIMD128_BIND_RETURN |
| 7816 | 7823 |
| 7817 Bind(&return_result); | 7824 Bind(&return_result); |
| 7818 return result_var.value(); | 7825 return result_var.value(); |
| 7819 } | 7826 } |
| 7820 | 7827 |
| 7828 Node* CodeStubAssembler::GetSuperConstructor(Node* active_function, | |
| 7829 Node* context) { | |
| 7830 Label is_not_object(this, Label::kDeferred), | |
| 7831 is_not_constructor(this, Label::kDeferred), out(this); | |
| 7832 Variable result(this, MachineRepresentation::kTagged); | |
| 7833 | |
| 7834 Node* map = LoadMap(active_function); | |
| 7835 Node* prototype = LoadMapPrototype(map); | |
| 7836 GotoIf(TaggedIsSmi(active_function), &is_not_object); | |
|
Benedikt Meurer
2016/12/09 18:30:28
This looks wrong. You first load the map, thereby
| |
| 7837 | |
| 7838 Node* prototype_map = LoadMap(prototype); | |
| 7839 GotoUnless(IsConstructorMap(prototype_map), &is_not_constructor); | |
| 7840 | |
| 7841 result.Bind(prototype); | |
| 7842 Goto(&out); | |
| 7843 | |
| 7844 Bind(&is_not_object); | |
|
Benedikt Meurer
2016/12/09 18:30:28
You don't need this label and the message below. T
| |
| 7845 { | |
| 7846 CallRuntime(Runtime::kThrowTypeError, context, | |
| 7847 SmiConstant(MessageTemplate::kMethodCalledOnWrongObject), | |
| 7848 HeapConstant(factory()->NewStringFromStaticChars("super"))); | |
| 7849 result.Bind(UndefinedConstant()); // Never reached. | |
| 7850 Goto(&out); | |
| 7851 } | |
| 7852 | |
| 7853 Bind(&is_not_constructor); | |
| 7854 { | |
| 7855 CallRuntime(Runtime::kThrowNotSuperConstructor, context, prototype, | |
| 7856 active_function); | |
| 7857 result.Bind(UndefinedConstant()); // Never reached. | |
| 7858 Goto(&out); | |
| 7859 } | |
| 7860 | |
| 7861 Bind(&out); | |
| 7862 return result.value(); | |
| 7863 } | |
| 7864 | |
| 7821 Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable, | 7865 Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable, |
| 7822 Node* context) { | 7866 Node* context) { |
| 7823 Label return_runtime(this, Label::kDeferred), end(this); | 7867 Label return_runtime(this, Label::kDeferred), end(this); |
| 7824 Variable result(this, MachineRepresentation::kTagged); | 7868 Variable result(this, MachineRepresentation::kTagged); |
| 7825 | 7869 |
| 7826 // Check if no one installed @@hasInstance somewhere. | 7870 // Check if no one installed @@hasInstance somewhere. |
| 7827 GotoUnless( | 7871 GotoUnless( |
| 7828 WordEqual(LoadObjectField(LoadRoot(Heap::kHasInstanceProtectorRootIndex), | 7872 WordEqual(LoadObjectField(LoadRoot(Heap::kHasInstanceProtectorRootIndex), |
| 7829 PropertyCell::kValueOffset), | 7873 PropertyCell::kValueOffset), |
| 7830 SmiConstant(Smi::FromInt(Isolate::kProtectorValid))), | 7874 SmiConstant(Smi::FromInt(Isolate::kProtectorValid))), |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8222 | 8266 |
| 8223 Node* CodeStubAssembler::IsDebugActive() { | 8267 Node* CodeStubAssembler::IsDebugActive() { |
| 8224 Node* is_debug_active = Load( | 8268 Node* is_debug_active = Load( |
| 8225 MachineType::Uint8(), | 8269 MachineType::Uint8(), |
| 8226 ExternalConstant(ExternalReference::debug_is_active_address(isolate()))); | 8270 ExternalConstant(ExternalReference::debug_is_active_address(isolate()))); |
| 8227 return WordNotEqual(is_debug_active, Int32Constant(0)); | 8271 return WordNotEqual(is_debug_active, Int32Constant(0)); |
| 8228 } | 8272 } |
| 8229 | 8273 |
| 8230 } // namespace internal | 8274 } // namespace internal |
| 8231 } // namespace v8 | 8275 } // namespace v8 |
| OLD | NEW |