| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 5025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5036 | 5036 |
| 5037 __ Bind(&done); | 5037 __ Bind(&done); |
| 5038 context()->Plug(result_register()); | 5038 context()->Plug(result_register()); |
| 5039 } | 5039 } |
| 5040 | 5040 |
| 5041 | 5041 |
| 5042 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { | 5042 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
| 5043 Label gc_required; | 5043 Label gc_required; |
| 5044 Label allocated; | 5044 Label allocated; |
| 5045 | 5045 |
| 5046 Handle<Map> map(isolate()->native_context()->iterator_result_map()); | 5046 const int instance_size = 5 * kPointerSize; |
| 5047 DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), |
| 5048 instance_size); |
| 5047 | 5049 |
| 5048 // Allocate and populate an object with this form: { value: VAL, done: DONE } | 5050 // Allocate and populate an object with this form: { value: VAL, done: DONE } |
| 5049 | 5051 |
| 5050 Register result = x0; | 5052 Register result = x0; |
| 5051 __ Allocate(map->instance_size(), result, x10, x11, &gc_required, TAG_OBJECT); | 5053 __ Allocate(instance_size, result, x10, x11, &gc_required, TAG_OBJECT); |
| 5052 __ B(&allocated); | 5054 __ B(&allocated); |
| 5053 | 5055 |
| 5054 __ Bind(&gc_required); | 5056 __ Bind(&gc_required); |
| 5055 __ Push(Smi::FromInt(map->instance_size())); | 5057 __ Push(Smi::FromInt(instance_size)); |
| 5056 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 5058 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
| 5057 __ Ldr(context_register(), | 5059 __ Ldr(context_register(), |
| 5058 MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5060 MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 5059 | 5061 |
| 5060 __ Bind(&allocated); | 5062 __ Bind(&allocated); |
| 5061 Register map_reg = x1; | 5063 Register map_reg = x1; |
| 5062 Register result_value = x2; | 5064 Register result_value = x2; |
| 5063 Register boolean_done = x3; | 5065 Register boolean_done = x3; |
| 5064 Register empty_fixed_array = x4; | 5066 Register empty_fixed_array = x4; |
| 5065 Register untagged_result = x5; | 5067 Register untagged_result = x5; |
| 5066 __ Mov(map_reg, Operand(map)); | 5068 __ Ldr(map_reg, GlobalObjectMemOperand()); |
| 5069 __ Ldr(map_reg, FieldMemOperand(map_reg, GlobalObject::kNativeContextOffset)); |
| 5070 __ Ldr(map_reg, |
| 5071 ContextMemOperand(map_reg, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 5067 __ Pop(result_value); | 5072 __ Pop(result_value); |
| 5068 __ Mov(boolean_done, Operand(isolate()->factory()->ToBoolean(done))); | 5073 __ Mov(boolean_done, Operand(isolate()->factory()->ToBoolean(done))); |
| 5069 __ Mov(empty_fixed_array, Operand(isolate()->factory()->empty_fixed_array())); | 5074 __ Mov(empty_fixed_array, Operand(isolate()->factory()->empty_fixed_array())); |
| 5070 DCHECK_EQ(map->instance_size(), 5 * kPointerSize); | |
| 5071 STATIC_ASSERT(JSObject::kPropertiesOffset + kPointerSize == | 5075 STATIC_ASSERT(JSObject::kPropertiesOffset + kPointerSize == |
| 5072 JSObject::kElementsOffset); | 5076 JSObject::kElementsOffset); |
| 5073 STATIC_ASSERT(JSGeneratorObject::kResultValuePropertyOffset + kPointerSize == | 5077 STATIC_ASSERT(JSGeneratorObject::kResultValuePropertyOffset + kPointerSize == |
| 5074 JSGeneratorObject::kResultDonePropertyOffset); | 5078 JSGeneratorObject::kResultDonePropertyOffset); |
| 5075 __ ObjectUntag(untagged_result, result); | 5079 __ ObjectUntag(untagged_result, result); |
| 5076 __ Str(map_reg, MemOperand(untagged_result, HeapObject::kMapOffset)); | 5080 __ Str(map_reg, MemOperand(untagged_result, HeapObject::kMapOffset)); |
| 5077 __ Stp(empty_fixed_array, empty_fixed_array, | 5081 __ Stp(empty_fixed_array, empty_fixed_array, |
| 5078 MemOperand(untagged_result, JSObject::kPropertiesOffset)); | 5082 MemOperand(untagged_result, JSObject::kPropertiesOffset)); |
| 5079 __ Stp(result_value, boolean_done, | 5083 __ Stp(result_value, boolean_done, |
| 5080 MemOperand(untagged_result, | 5084 MemOperand(untagged_result, |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5331 return previous_; | 5335 return previous_; |
| 5332 } | 5336 } |
| 5333 | 5337 |
| 5334 | 5338 |
| 5335 #undef __ | 5339 #undef __ |
| 5336 | 5340 |
| 5337 | 5341 |
| 5338 } } // namespace v8::internal | 5342 } } // namespace v8::internal |
| 5339 | 5343 |
| 5340 #endif // V8_TARGET_ARCH_ARM64 | 5344 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |