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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // - x1: the JS function object being called (i.e. ourselves). | 96 // - x1: the JS function object being called (i.e. ourselves). |
97 // - cp: our context. | 97 // - cp: our context. |
98 // - fp: our caller's frame pointer. | 98 // - fp: our caller's frame pointer. |
99 // - jssp: stack pointer. | 99 // - jssp: stack pointer. |
100 // - lr: return address. | 100 // - lr: return address. |
101 // | 101 // |
102 // The function builds a JS frame. See JavaScriptFrameConstants in | 102 // The function builds a JS frame. See JavaScriptFrameConstants in |
103 // frames-arm.h for its layout. | 103 // frames-arm.h for its layout. |
104 void FullCodeGenerator::Generate() { | 104 void FullCodeGenerator::Generate() { |
105 CompilationInfo* info = info_; | 105 CompilationInfo* info = info_; |
106 handler_table_ = | |
107 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( | |
108 HandlerTable::LengthForRange(function()->handler_count()), TENURED)); | |
109 | |
110 profiling_counter_ = isolate()->factory()->NewCell( | 106 profiling_counter_ = isolate()->factory()->NewCell( |
111 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 107 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
112 SetFunctionPosition(function()); | 108 SetFunctionPosition(function()); |
113 Comment cmnt(masm_, "[ Function compiled by full code generator"); | 109 Comment cmnt(masm_, "[ Function compiled by full code generator"); |
114 | 110 |
115 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 111 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
116 | 112 |
117 #ifdef DEBUG | 113 #ifdef DEBUG |
118 if (strlen(FLAG_stop_at) > 0 && | 114 if (strlen(FLAG_stop_at) > 0 && |
119 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 115 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
(...skipping 5014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5134 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" | 5130 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" |
5135 __ Peek(x3, 1 * kPointerSize); // iter | 5131 __ Peek(x3, 1 * kPointerSize); // iter |
5136 __ Push(load_name, x3, x0); // "throw", iter, except | 5132 __ Push(load_name, x3, x0); // "throw", iter, except |
5137 __ B(&l_call); | 5133 __ B(&l_call); |
5138 | 5134 |
5139 // try { received = %yield result } | 5135 // try { received = %yield result } |
5140 // Shuffle the received result above a try handler and yield it without | 5136 // Shuffle the received result above a try handler and yield it without |
5141 // re-boxing. | 5137 // re-boxing. |
5142 __ Bind(&l_try); | 5138 __ Bind(&l_try); |
5143 __ Pop(x0); // result | 5139 __ Pop(x0); // result |
5144 EnterTryBlock(expr->index(), &l_catch); | 5140 int handler_index = NewHandlerTableEntry(); |
| 5141 EnterTryBlock(handler_index, &l_catch); |
5145 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 5142 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
5146 __ Push(x0); // result | 5143 __ Push(x0); // result |
5147 __ B(&l_suspend); | 5144 __ B(&l_suspend); |
5148 | 5145 |
5149 // TODO(jbramley): This label is bound here because the following code | 5146 // TODO(jbramley): This label is bound here because the following code |
5150 // looks at its pos(). Is it possible to do something more efficient here, | 5147 // looks at its pos(). Is it possible to do something more efficient here, |
5151 // perhaps using Adr? | 5148 // perhaps using Adr? |
5152 __ Bind(&l_continuation); | 5149 __ Bind(&l_continuation); |
5153 __ B(&l_resume); | 5150 __ B(&l_resume); |
5154 | 5151 |
5155 __ Bind(&l_suspend); | 5152 __ Bind(&l_suspend); |
5156 const int generator_object_depth = kPointerSize + try_block_size; | 5153 const int generator_object_depth = kPointerSize + try_block_size; |
5157 __ Peek(x0, generator_object_depth); | 5154 __ Peek(x0, generator_object_depth); |
5158 __ Push(x0); // g | 5155 __ Push(x0); // g |
5159 __ Push(Smi::FromInt(expr->index())); // handler-index | 5156 __ Push(Smi::FromInt(handler_index)); // handler-index |
5160 DCHECK((l_continuation.pos() > 0) && Smi::IsValid(l_continuation.pos())); | 5157 DCHECK((l_continuation.pos() > 0) && Smi::IsValid(l_continuation.pos())); |
5161 __ Mov(x1, Smi::FromInt(l_continuation.pos())); | 5158 __ Mov(x1, Smi::FromInt(l_continuation.pos())); |
5162 __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset)); | 5159 __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset)); |
5163 __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset)); | 5160 __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset)); |
5164 __ Mov(x1, cp); | 5161 __ Mov(x1, cp); |
5165 __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2, | 5162 __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2, |
5166 kLRHasBeenSaved, kDontSaveFPRegs); | 5163 kLRHasBeenSaved, kDontSaveFPRegs); |
5167 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); | 5164 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); |
5168 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5165 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
5169 __ Pop(x0); // result | 5166 __ Pop(x0); // result |
5170 EmitReturnSequence(); | 5167 EmitReturnSequence(); |
5171 __ Bind(&l_resume); // received in x0 | 5168 __ Bind(&l_resume); // received in x0 |
5172 ExitTryBlock(expr->index()); | 5169 ExitTryBlock(handler_index); |
5173 | 5170 |
5174 // receiver = iter; f = 'next'; arg = received; | 5171 // receiver = iter; f = 'next'; arg = received; |
5175 __ Bind(&l_next); | 5172 __ Bind(&l_next); |
5176 | 5173 |
5177 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 5174 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
5178 __ Peek(x3, 1 * kPointerSize); // iter | 5175 __ Peek(x3, 1 * kPointerSize); // iter |
5179 __ Push(load_name, x3, x0); // "next", iter, received | 5176 __ Push(load_name, x3, x0); // "next", iter, received |
5180 | 5177 |
5181 // result = receiver[f](arg); | 5178 // result = receiver[f](arg); |
5182 __ Bind(&l_call); | 5179 __ Bind(&l_call); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5571 } | 5568 } |
5572 | 5569 |
5573 return INTERRUPT; | 5570 return INTERRUPT; |
5574 } | 5571 } |
5575 | 5572 |
5576 | 5573 |
5577 } // namespace internal | 5574 } // namespace internal |
5578 } // namespace v8 | 5575 } // namespace v8 |
5579 | 5576 |
5580 #endif // V8_TARGET_ARCH_ARM64 | 5577 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |