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