| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5198 __ JumpIfSmi(cell_value, &slow_case); | 5192 __ JumpIfSmi(cell_value, &slow_case); |
| 5199 | 5193 |
| 5200 __ ldr(cell_value_map, FieldMemOperand(cell_value, HeapObject::kMapOffset)); | 5194 __ ldr(cell_value_map, FieldMemOperand(cell_value, HeapObject::kMapOffset)); |
| 5201 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); | 5195 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); |
| 5202 __ cmp(cell_value_map, scratch); | 5196 __ cmp(cell_value_map, scratch); |
| 5203 __ b(eq, &fast_heapobject_case); | 5197 __ b(eq, &fast_heapobject_case); |
| 5204 | 5198 |
| 5205 // Fallback to runtime. | 5199 // Fallback to runtime. |
| 5206 __ bind(&slow_case); | 5200 __ bind(&slow_case); |
| 5207 __ SmiTag(slot); | 5201 __ SmiTag(slot); |
| 5208 __ push(slot); | 5202 __ Push(slot, value); |
| 5209 __ push(name); | |
| 5210 __ push(value); | |
| 5211 __ TailCallRuntime(is_strict(language_mode()) | 5203 __ TailCallRuntime(is_strict(language_mode()) |
| 5212 ? Runtime::kStoreGlobalViaContext_Strict | 5204 ? Runtime::kStoreGlobalViaContext_Strict |
| 5213 : Runtime::kStoreGlobalViaContext_Sloppy, | 5205 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 5214 3, 1); | 5206 2, 1); |
| 5215 } | 5207 } |
| 5216 | 5208 |
| 5217 | 5209 |
| 5218 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 5210 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
| 5219 return ref0.address() - ref1.address(); | 5211 return ref0.address() - ref1.address(); |
| 5220 } | 5212 } |
| 5221 | 5213 |
| 5222 | 5214 |
| 5223 // Calls an API function. Allocates HandleScope, extracts returned value | 5215 // Calls an API function. Allocates HandleScope, extracts returned value |
| 5224 // from handle and propagates exceptions. Restores context. stack_space | 5216 // from handle and propagates exceptions. Restores context. stack_space |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5530 MemOperand(fp, 6 * kPointerSize), NULL); | 5522 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5531 } | 5523 } |
| 5532 | 5524 |
| 5533 | 5525 |
| 5534 #undef __ | 5526 #undef __ |
| 5535 | 5527 |
| 5536 } // namespace internal | 5528 } // namespace internal |
| 5537 } // namespace v8 | 5529 } // namespace v8 |
| 5538 | 5530 |
| 5539 #endif // V8_TARGET_ARCH_ARM | 5531 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |