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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 5043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5054 | 5054 |
5055 __ bind(&fast_elements_case); | 5055 __ bind(&fast_elements_case); |
5056 GenerateCase(masm, FAST_ELEMENTS); | 5056 GenerateCase(masm, FAST_ELEMENTS); |
5057 } | 5057 } |
5058 | 5058 |
5059 | 5059 |
5060 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5060 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { |
5061 Register context = cp; | 5061 Register context = cp; |
5062 Register result = r0; | 5062 Register result = r0; |
5063 Register slot = r2; | 5063 Register slot = r2; |
5064 Register name = r3; | |
5065 Label slow_case; | |
5066 | 5064 |
5067 // Go up the context chain to the script context. | 5065 // Go up the context chain to the script context. |
5068 for (int i = 0; i < depth(); ++i) { | 5066 for (int i = 0; i < depth(); ++i) { |
5069 __ ldr(result, ContextOperand(context, Context::PREVIOUS_INDEX)); | 5067 __ ldr(result, ContextOperand(context, Context::PREVIOUS_INDEX)); |
5070 context = result; | 5068 context = result; |
5071 } | 5069 } |
5072 | 5070 |
5073 // Load the PropertyCell value at the specified slot. | 5071 // Load the PropertyCell value at the specified slot. |
5074 __ add(result, context, Operand(slot, LSL, kPointerSizeLog2)); | 5072 __ add(result, context, Operand(slot, LSL, kPointerSizeLog2)); |
5075 __ ldr(result, ContextOperand(result)); | 5073 __ ldr(result, ContextOperand(result)); |
5076 __ ldr(result, FieldMemOperand(result, PropertyCell::kValueOffset)); | 5074 __ ldr(result, FieldMemOperand(result, PropertyCell::kValueOffset)); |
5077 | 5075 |
5078 // If the result is not the_hole, return. Otherwise, handle in the runtime. | 5076 // If the result is not the_hole, return. Otherwise, handle in the runtime. |
5079 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 5077 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
5080 __ Ret(ne); | 5078 __ Ret(ne); |
5081 | 5079 |
5082 // Fallback to runtime. | 5080 // Fallback to runtime. |
5083 __ bind(&slow_case); | |
5084 __ SmiTag(slot); | 5081 __ SmiTag(slot); |
5085 __ push(slot); | 5082 __ push(slot); |
5086 __ push(name); | 5083 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1); |
5087 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); | |
5088 } | 5084 } |
5089 | 5085 |
5090 | 5086 |
5091 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { | 5087 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
5092 Register value = r0; | 5088 Register value = r0; |
5093 Register slot = r2; | 5089 Register slot = r2; |
5094 Register name = r3; | |
5095 | 5090 |
5096 Register cell = r1; | 5091 Register cell = r1; |
5097 Register cell_details = r4; | 5092 Register cell_details = r4; |
5098 Register cell_value = r5; | 5093 Register cell_value = r5; |
5099 Register cell_value_map = r6; | 5094 Register cell_value_map = r6; |
5100 Register scratch = r9; | 5095 Register scratch = r9; |
5101 | 5096 |
5102 Register context = cp; | 5097 Register context = cp; |
5103 Register context_temp = cell; | 5098 Register context_temp = cell; |
5104 | 5099 |
5105 Label fast_heapobject_case, fast_smi_case, slow_case; | 5100 Label fast_heapobject_case, fast_smi_case, slow_case; |
5106 | 5101 |
5107 if (FLAG_debug_code) { | 5102 if (FLAG_debug_code) { |
5108 __ CompareRoot(value, Heap::kTheHoleValueRootIndex); | 5103 __ CompareRoot(value, Heap::kTheHoleValueRootIndex); |
5109 __ Check(ne, kUnexpectedValue); | 5104 __ Check(ne, kUnexpectedValue); |
5110 __ AssertName(name); | |
5111 } | 5105 } |
5112 | 5106 |
5113 // Go up the context chain to the script context. | 5107 // Go up the context chain to the script context. |
5114 for (int i = 0; i < depth(); i++) { | 5108 for (int i = 0; i < depth(); i++) { |
5115 __ ldr(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); | 5109 __ ldr(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
5116 context = context_temp; | 5110 context = context_temp; |
5117 } | 5111 } |
5118 | 5112 |
5119 // Load the PropertyCell at the specified slot. | 5113 // Load the PropertyCell at the specified slot. |
5120 __ add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); | 5114 __ add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5200 __ JumpIfSmi(cell_value, &slow_case); | 5194 __ JumpIfSmi(cell_value, &slow_case); |
5201 | 5195 |
5202 __ ldr(cell_value_map, FieldMemOperand(cell_value, HeapObject::kMapOffset)); | 5196 __ ldr(cell_value_map, FieldMemOperand(cell_value, HeapObject::kMapOffset)); |
5203 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); | 5197 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); |
5204 __ cmp(cell_value_map, scratch); | 5198 __ cmp(cell_value_map, scratch); |
5205 __ b(eq, &fast_heapobject_case); | 5199 __ b(eq, &fast_heapobject_case); |
5206 | 5200 |
5207 // Fallback to runtime. | 5201 // Fallback to runtime. |
5208 __ bind(&slow_case); | 5202 __ bind(&slow_case); |
5209 __ SmiTag(slot); | 5203 __ SmiTag(slot); |
5210 __ push(slot); | 5204 __ Push(slot, value); |
5211 __ push(name); | |
5212 __ push(value); | |
5213 __ TailCallRuntime(is_strict(language_mode()) | 5205 __ TailCallRuntime(is_strict(language_mode()) |
5214 ? Runtime::kStoreGlobalViaContext_Strict | 5206 ? Runtime::kStoreGlobalViaContext_Strict |
5215 : Runtime::kStoreGlobalViaContext_Sloppy, | 5207 : Runtime::kStoreGlobalViaContext_Sloppy, |
5216 3, 1); | 5208 2, 1); |
5217 } | 5209 } |
5218 | 5210 |
5219 | 5211 |
5220 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 5212 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
5221 return ref0.address() - ref1.address(); | 5213 return ref0.address() - ref1.address(); |
5222 } | 5214 } |
5223 | 5215 |
5224 | 5216 |
5225 // Calls an API function. Allocates HandleScope, extracts returned value | 5217 // Calls an API function. Allocates HandleScope, extracts returned value |
5226 // from handle and propagates exceptions. Restores context. stack_space | 5218 // from handle and propagates exceptions. Restores context. stack_space |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5532 MemOperand(fp, 6 * kPointerSize), NULL); | 5524 MemOperand(fp, 6 * kPointerSize), NULL); |
5533 } | 5525 } |
5534 | 5526 |
5535 | 5527 |
5536 #undef __ | 5528 #undef __ |
5537 | 5529 |
5538 } // namespace internal | 5530 } // namespace internal |
5539 } // namespace v8 | 5531 } // namespace v8 |
5540 | 5532 |
5541 #endif // V8_TARGET_ARCH_ARM | 5533 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |