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 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 // -- ebx : call_data | 3296 // -- ebx : call_data |
3297 // -- ecx : holder | 3297 // -- ecx : holder |
3298 // -- edx : api_function_address | 3298 // -- edx : api_function_address |
3299 // -- esi : context | 3299 // -- esi : context |
3300 // -- | 3300 // -- |
3301 // -- esp[0] : return address | 3301 // -- esp[0] : return address |
3302 // -- esp[4] : last argument | 3302 // -- esp[4] : last argument |
3303 // -- ... | 3303 // -- ... |
3304 // -- esp[argc * 4] : first argument | 3304 // -- esp[argc * 4] : first argument |
3305 // -- esp[(argc + 1) * 4] : receiver | 3305 // -- esp[(argc + 1) * 4] : receiver |
| 3306 // -- esp[(argc + 2) * 4] : accessor_holder |
3306 // ----------------------------------- | 3307 // ----------------------------------- |
3307 | 3308 |
3308 Register callee = edi; | 3309 Register callee = edi; |
3309 Register call_data = ebx; | 3310 Register call_data = ebx; |
3310 Register holder = ecx; | 3311 Register holder = ecx; |
3311 Register api_function_address = edx; | 3312 Register api_function_address = edx; |
3312 Register context = esi; | 3313 Register context = esi; |
3313 Register return_address = eax; | 3314 Register return_address = eax; |
3314 | 3315 |
3315 typedef FunctionCallbackArguments FCA; | 3316 typedef FunctionCallbackArguments FCA; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3348 // return value | 3349 // return value |
3349 __ push(scratch); | 3350 __ push(scratch); |
3350 // return value default | 3351 // return value default |
3351 __ push(scratch); | 3352 __ push(scratch); |
3352 } | 3353 } |
3353 // isolate | 3354 // isolate |
3354 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); | 3355 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); |
3355 // holder | 3356 // holder |
3356 __ push(holder); | 3357 __ push(holder); |
3357 | 3358 |
| 3359 // enter a new context |
| 3360 if (is_lazy()) { |
| 3361 // load context from accessor_holder |
| 3362 Register accessor_holder = context; |
| 3363 __ movp(accessor_holder, |
| 3364 MemOperand(esp, (argc() + FCA::kArgsLength + 1) * kPointerSize)); |
| 3365 __ movp(scratch, FieldOperand(accessor_holder, HeapObject::kMapOffset)); |
| 3366 __ GetMapConstructor(scratch, scratch, context); |
| 3367 __ movp(context, FieldOperand(scratch, JSFunction::kContextOffset)); |
| 3368 } else { |
| 3369 // load context from callee |
| 3370 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); |
| 3371 } |
| 3372 |
3358 __ mov(scratch, esp); | 3373 __ mov(scratch, esp); |
3359 | 3374 |
3360 // push return address | 3375 // push return address |
3361 __ push(return_address); | 3376 __ push(return_address); |
3362 | 3377 |
3363 if (!is_lazy()) { | |
3364 // load context from callee | |
3365 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); | |
3366 } | |
3367 | |
3368 // API function gets reference to the v8::Arguments. If CPU profiler | 3378 // API function gets reference to the v8::Arguments. If CPU profiler |
3369 // is enabled wrapper function will be called and we need to pass | 3379 // is enabled wrapper function will be called and we need to pass |
3370 // address of the callback as additional parameter, always allocate | 3380 // address of the callback as additional parameter, always allocate |
3371 // space for it. | 3381 // space for it. |
3372 const int kApiArgc = 1 + 1; | 3382 const int kApiArgc = 1 + 1; |
3373 | 3383 |
3374 // Allocate the v8::Arguments structure in the arguments' space since | 3384 // Allocate the v8::Arguments structure in the arguments' space since |
3375 // it's not controlled by GC. | 3385 // it's not controlled by GC. |
3376 const int kApiStackSpace = 3; | 3386 const int kApiStackSpace = 3; |
3377 | 3387 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3484 kStackUnwindSpace, nullptr, return_value_operand, | 3494 kStackUnwindSpace, nullptr, return_value_operand, |
3485 NULL); | 3495 NULL); |
3486 } | 3496 } |
3487 | 3497 |
3488 #undef __ | 3498 #undef __ |
3489 | 3499 |
3490 } // namespace internal | 3500 } // namespace internal |
3491 } // namespace v8 | 3501 } // namespace v8 |
3492 | 3502 |
3493 #endif // V8_TARGET_ARCH_X87 | 3503 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |