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 3219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3230 // -- ebx : call_data | 3230 // -- ebx : call_data |
3231 // -- ecx : holder | 3231 // -- ecx : holder |
3232 // -- edx : api_function_address | 3232 // -- edx : api_function_address |
3233 // -- esi : context | 3233 // -- esi : context |
3234 // -- | 3234 // -- |
3235 // -- esp[0] : return address | 3235 // -- esp[0] : return address |
3236 // -- esp[4] : last argument | 3236 // -- esp[4] : last argument |
3237 // -- ... | 3237 // -- ... |
3238 // -- esp[argc * 4] : first argument | 3238 // -- esp[argc * 4] : first argument |
3239 // -- esp[(argc + 1) * 4] : receiver | 3239 // -- esp[(argc + 1) * 4] : receiver |
| 3240 // -- esp[(argc + 2) * 4] : accessor_holder |
3240 // ----------------------------------- | 3241 // ----------------------------------- |
3241 | 3242 |
3242 Register callee = edi; | 3243 Register callee = edi; |
3243 Register call_data = ebx; | 3244 Register call_data = ebx; |
3244 Register holder = ecx; | 3245 Register holder = ecx; |
3245 Register api_function_address = edx; | 3246 Register api_function_address = edx; |
3246 Register context = esi; | 3247 Register context = esi; |
3247 Register return_address = eax; | 3248 Register return_address = eax; |
3248 | 3249 |
3249 typedef FunctionCallbackArguments FCA; | 3250 typedef FunctionCallbackArguments FCA; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3282 // return value | 3283 // return value |
3283 __ push(scratch); | 3284 __ push(scratch); |
3284 // return value default | 3285 // return value default |
3285 __ push(scratch); | 3286 __ push(scratch); |
3286 } | 3287 } |
3287 // isolate | 3288 // isolate |
3288 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); | 3289 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); |
3289 // holder | 3290 // holder |
3290 __ push(holder); | 3291 __ push(holder); |
3291 | 3292 |
| 3293 // enter a new context |
| 3294 if (is_lazy()) { |
| 3295 // load context from accessor_holder |
| 3296 Register accessor_holder = context; |
| 3297 __ movp(accessor_holder, |
| 3298 MemOperand(esp, (argc() + FCA::kArgsLength + 1) * kPointerSize)); |
| 3299 __ movp(scratch, FieldOperand(accessor_holder, HeapObject::kMapOffset)); |
| 3300 __ GetMapConstructor(scratch, scratch, context); |
| 3301 __ movp(context, FieldOperand(scratch, JSFunction::kContextOffset)); |
| 3302 } else { |
| 3303 // load context from callee |
| 3304 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); |
| 3305 } |
| 3306 |
3292 __ mov(scratch, esp); | 3307 __ mov(scratch, esp); |
3293 | 3308 |
3294 // push return address | 3309 // push return address |
3295 __ push(return_address); | 3310 __ push(return_address); |
3296 | 3311 |
3297 if (!is_lazy()) { | |
3298 // load context from callee | |
3299 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); | |
3300 } | |
3301 | |
3302 // API function gets reference to the v8::Arguments. If CPU profiler | 3312 // API function gets reference to the v8::Arguments. If CPU profiler |
3303 // is enabled wrapper function will be called and we need to pass | 3313 // is enabled wrapper function will be called and we need to pass |
3304 // address of the callback as additional parameter, always allocate | 3314 // address of the callback as additional parameter, always allocate |
3305 // space for it. | 3315 // space for it. |
3306 const int kApiArgc = 1 + 1; | 3316 const int kApiArgc = 1 + 1; |
3307 | 3317 |
3308 // Allocate the v8::Arguments structure in the arguments' space since | 3318 // Allocate the v8::Arguments structure in the arguments' space since |
3309 // it's not controlled by GC. | 3319 // it's not controlled by GC. |
3310 const int kApiStackSpace = 3; | 3320 const int kApiStackSpace = 3; |
3311 | 3321 |
(...skipping 17 matching lines...) Expand all Loading... |
3329 Operand context_restore_operand(ebp, | 3339 Operand context_restore_operand(ebp, |
3330 (2 + FCA::kContextSaveIndex) * kPointerSize); | 3340 (2 + FCA::kContextSaveIndex) * kPointerSize); |
3331 // Stores return the first js argument | 3341 // Stores return the first js argument |
3332 int return_value_offset = 0; | 3342 int return_value_offset = 0; |
3333 if (is_store()) { | 3343 if (is_store()) { |
3334 return_value_offset = 2 + FCA::kArgsLength; | 3344 return_value_offset = 2 + FCA::kArgsLength; |
3335 } else { | 3345 } else { |
3336 return_value_offset = 2 + FCA::kReturnValueOffset; | 3346 return_value_offset = 2 + FCA::kReturnValueOffset; |
3337 } | 3347 } |
3338 Operand return_value_operand(ebp, return_value_offset * kPointerSize); | 3348 Operand return_value_operand(ebp, return_value_offset * kPointerSize); |
3339 int stack_space = 0; | 3349 const int stack_space = argc() + FCA::kArgsLength + 2; |
3340 Operand length_operand = ApiParameterOperand(4); | 3350 Operand* stack_space_operand = nullptr; |
3341 Operand* stack_space_operand = &length_operand; | |
3342 stack_space = argc() + FCA::kArgsLength + 1; | |
3343 stack_space_operand = nullptr; | |
3344 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 3351 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
3345 ApiParameterOperand(1), stack_space, | 3352 ApiParameterOperand(1), stack_space, |
3346 stack_space_operand, return_value_operand, | 3353 stack_space_operand, return_value_operand, |
3347 &context_restore_operand); | 3354 &context_restore_operand); |
3348 } | 3355 } |
3349 | 3356 |
3350 | 3357 |
3351 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 3358 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
3352 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 3359 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
3353 // name below the exit frame to make GC aware of them. | 3360 // name below the exit frame to make GC aware of them. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3418 kStackUnwindSpace, nullptr, return_value_operand, | 3425 kStackUnwindSpace, nullptr, return_value_operand, |
3419 NULL); | 3426 NULL); |
3420 } | 3427 } |
3421 | 3428 |
3422 #undef __ | 3429 #undef __ |
3423 | 3430 |
3424 } // namespace internal | 3431 } // namespace internal |
3425 } // namespace v8 | 3432 } // namespace v8 |
3426 | 3433 |
3427 #endif // V8_TARGET_ARCH_X87 | 3434 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |