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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3167 | 3167 |
3168 __ Bind(&runtime); | 3168 __ Bind(&runtime); |
3169 CallRuntimeWithOperands(Runtime::kCreateIterResultObject); | 3169 CallRuntimeWithOperands(Runtime::kCreateIterResultObject); |
3170 | 3170 |
3171 __ Bind(&done); | 3171 __ Bind(&done); |
3172 context()->Plug(x0); | 3172 context()->Plug(x0); |
3173 } | 3173 } |
3174 | 3174 |
3175 | 3175 |
3176 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 3176 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
| 3177 // Push function. |
| 3178 __ LoadNativeContextSlot(expr->context_index(), x0); |
| 3179 PushOperand(x0); |
| 3180 |
3177 // Push undefined as the receiver. | 3181 // Push undefined as the receiver. |
3178 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex); | 3182 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex); |
3179 PushOperand(x0); | 3183 PushOperand(x0); |
3180 | |
3181 __ LoadNativeContextSlot(expr->context_index(), x0); | |
3182 } | 3184 } |
3183 | 3185 |
3184 | 3186 |
3185 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 3187 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
3186 ZoneList<Expression*>* args = expr->arguments(); | 3188 ZoneList<Expression*>* args = expr->arguments(); |
3187 int arg_count = args->length(); | 3189 int arg_count = args->length(); |
3188 | 3190 |
3189 SetCallPosition(expr); | 3191 SetCallPosition(expr); |
3190 __ Peek(x1, (arg_count + 1) * kPointerSize); | 3192 __ Peek(x1, (arg_count + 1) * kPointerSize); |
3191 __ Mov(x0, arg_count); | 3193 __ Mov(x0, arg_count); |
3192 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 3194 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
3193 RelocInfo::CODE_TARGET); | 3195 RelocInfo::CODE_TARGET); |
3194 OperandStackDepthDecrement(arg_count + 1); | 3196 OperandStackDepthDecrement(arg_count + 1); |
3195 } | 3197 } |
3196 | 3198 |
3197 | 3199 |
3198 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 3200 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
3199 ZoneList<Expression*>* args = expr->arguments(); | 3201 ZoneList<Expression*>* args = expr->arguments(); |
3200 int arg_count = args->length(); | 3202 int arg_count = args->length(); |
3201 | 3203 |
3202 if (expr->is_jsruntime()) { | 3204 if (expr->is_jsruntime()) { |
3203 Comment cmnt(masm_, "[ CallRunTime"); | 3205 Comment cmnt(masm_, "[ CallRunTime"); |
3204 EmitLoadJSRuntimeFunction(expr); | 3206 EmitLoadJSRuntimeFunction(expr); |
3205 | 3207 |
3206 // Push the target function under the receiver. | |
3207 PopOperand(x10); | |
3208 PushOperands(x0, x10); | |
3209 | |
3210 for (int i = 0; i < arg_count; i++) { | 3208 for (int i = 0; i < arg_count; i++) { |
3211 VisitForStackValue(args->at(i)); | 3209 VisitForStackValue(args->at(i)); |
3212 } | 3210 } |
3213 | 3211 |
3214 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 3212 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
3215 EmitCallJSRuntimeFunction(expr); | 3213 EmitCallJSRuntimeFunction(expr); |
3216 | 3214 |
3217 // Restore context register. | 3215 // Restore context register. |
3218 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3216 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3219 | 3217 |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4215 } | 4213 } |
4216 | 4214 |
4217 return INTERRUPT; | 4215 return INTERRUPT; |
4218 } | 4216 } |
4219 | 4217 |
4220 | 4218 |
4221 } // namespace internal | 4219 } // namespace internal |
4222 } // namespace v8 | 4220 } // namespace v8 |
4223 | 4221 |
4224 #endif // V8_TARGET_ARCH_ARM64 | 4222 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |