OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3124 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3124 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3125 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3125 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3126 } | 3126 } |
3127 | 3127 |
3128 | 3128 |
3129 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3129 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3130 Register function = ToRegister(instr->function()); | 3130 Register function = ToRegister(instr->function()); |
3131 Register temp = ToRegister(instr->temp()); | 3131 Register temp = ToRegister(instr->temp()); |
3132 Register result = ToRegister(instr->result()); | 3132 Register result = ToRegister(instr->result()); |
3133 | 3133 |
3134 // Check that the function really is a function. | |
3135 __ CmpObjectType(function, JS_FUNCTION_TYPE, result); | |
3136 DeoptimizeIf(not_equal, instr->environment()); | |
3137 | |
3138 // Check whether the function has an instance prototype. | |
3139 Label non_instance; | |
3140 __ test_b(FieldOperand(result, Map::kBitFieldOffset), | |
3141 1 << Map::kHasNonInstancePrototype); | |
3142 __ j(not_zero, &non_instance, Label::kNear); | |
3143 | |
3144 // Get the prototype or initial map from the function. | 3134 // Get the prototype or initial map from the function. |
3145 __ mov(result, | 3135 __ mov(result, |
3146 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 3136 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
3147 | 3137 |
3148 // Check that the function has a prototype or an initial map. | 3138 // Check that the function has a prototype or an initial map. |
3149 __ cmp(Operand(result), Immediate(factory()->the_hole_value())); | 3139 __ cmp(Operand(result), Immediate(factory()->the_hole_value())); |
3150 DeoptimizeIf(equal, instr->environment()); | 3140 DeoptimizeIf(equal, instr->environment()); |
3151 | 3141 |
3152 // If the function does not have an initial map, we're done. | 3142 // If the function does not have an initial map, we're done. |
3153 Label done; | 3143 Label done; |
3154 __ CmpObjectType(result, MAP_TYPE, temp); | 3144 __ CmpObjectType(result, MAP_TYPE, temp); |
3155 __ j(not_equal, &done, Label::kNear); | 3145 __ j(not_equal, &done, Label::kNear); |
3156 | 3146 |
3157 // Get the prototype from the initial map. | 3147 // Get the prototype from the initial map. |
3158 __ mov(result, FieldOperand(result, Map::kPrototypeOffset)); | 3148 __ mov(result, FieldOperand(result, Map::kPrototypeOffset)); |
3159 __ jmp(&done, Label::kNear); | |
3160 | |
3161 // Non-instance prototype: Fetch prototype from constructor field | |
3162 // in the function's map. | |
3163 __ bind(&non_instance); | |
3164 __ mov(result, FieldOperand(result, Map::kConstructorOffset)); | |
3165 | 3149 |
3166 // All done. | 3150 // All done. |
3167 __ bind(&done); | 3151 __ bind(&done); |
3168 } | 3152 } |
3169 | 3153 |
3170 | 3154 |
3171 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { | 3155 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { |
3172 Register result = ToRegister(instr->result()); | 3156 Register result = ToRegister(instr->result()); |
3173 __ LoadRoot(result, instr->index()); | 3157 __ LoadRoot(result, instr->index()); |
3174 } | 3158 } |
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5719 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5703 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5720 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5704 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5721 } | 5705 } |
5722 | 5706 |
5723 | 5707 |
5724 #undef __ | 5708 #undef __ |
5725 | 5709 |
5726 } } // namespace v8::internal | 5710 } } // namespace v8::internal |
5727 | 5711 |
5728 #endif // V8_TARGET_ARCH_X87 | 5712 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |