| 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/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 5326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5337 bool is_store = this->is_store(); | 5337 bool is_store = this->is_store(); |
| 5338 int argc = this->argc(); | 5338 int argc = this->argc(); |
| 5339 bool call_data_undefined = this->call_data_undefined(); | 5339 bool call_data_undefined = this->call_data_undefined(); |
| 5340 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, | 5340 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, |
| 5341 call_data_undefined); | 5341 call_data_undefined); |
| 5342 } | 5342 } |
| 5343 | 5343 |
| 5344 | 5344 |
| 5345 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5345 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5346 // ----------- S t a t e ------------- | 5346 // ----------- S t a t e ------------- |
| 5347 // -- esp[0] : return address | 5347 // -- esp[0] : return address |
| 5348 // -- esp[4] : name | 5348 // -- esp[4] : name |
| 5349 // -- esp[8 .. (8 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ | 5349 // -- esp[8 - kArgsLength*4] : PropertyCallbackArguments object |
| 5350 // -- ... | 5350 // -- ... |
| 5351 // -- edx : api_function_address | 5351 // -- edx : api_function_address |
| 5352 // ----------------------------------- | 5352 // ----------------------------------- |
| 5353 DCHECK(edx.is(ApiGetterDescriptor::function_address())); | 5353 DCHECK(edx.is(ApiGetterDescriptor::function_address())); |
| 5354 | 5354 |
| 5355 // v8::PropertyCallbackInfo::args_ array and name handle. | 5355 // array for v8::Arguments::values_, handler for name and pointer |
| 5356 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5356 // to the values (it considered as smi in GC). |
| 5357 | 5357 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 2; |
| 5358 // Allocate v8::PropertyCallbackInfo object, arguments for callback and | 5358 // Allocate space for opional callback address parameter in case |
| 5359 // space for optional callback address parameter (in case CPU profiler is | 5359 // CPU profiler is active. |
| 5360 // active) in non-GCed stack space. | 5360 const int kApiArgc = 2 + 1; |
| 5361 const int kApiArgc = 3 + 1; | |
| 5362 | 5361 |
| 5363 Register api_function_address = edx; | 5362 Register api_function_address = edx; |
| 5364 Register scratch = ebx; | 5363 Register scratch = ebx; |
| 5365 | 5364 |
| 5366 // Load address of v8::PropertyAccessorInfo::args_ array. | 5365 // load address of name |
| 5367 __ lea(scratch, Operand(esp, 2 * kPointerSize)); | 5366 __ lea(scratch, Operand(esp, 1 * kPointerSize)); |
| 5368 | 5367 |
| 5369 PrepareCallApiFunction(masm, kApiArgc); | 5368 PrepareCallApiFunction(masm, kApiArgc); |
| 5370 // Create v8::PropertyCallbackInfo object on the stack and initialize | |
| 5371 // it's args_ field. | |
| 5372 Operand info_object = ApiParameterOperand(3); | |
| 5373 __ mov(info_object, scratch); | |
| 5374 | |
| 5375 __ sub(scratch, Immediate(kPointerSize)); | |
| 5376 __ mov(ApiParameterOperand(0), scratch); // name. | 5369 __ mov(ApiParameterOperand(0), scratch); // name. |
| 5377 __ lea(scratch, info_object); | 5370 __ add(scratch, Immediate(kPointerSize)); |
| 5378 __ mov(ApiParameterOperand(1), scratch); // arguments pointer. | 5371 __ mov(ApiParameterOperand(1), scratch); // arguments pointer. |
| 5379 // Reserve space for optional callback address parameter. | |
| 5380 Operand thunk_last_arg = ApiParameterOperand(2); | |
| 5381 | 5372 |
| 5382 ExternalReference thunk_ref = | 5373 ExternalReference thunk_ref = |
| 5383 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5374 ExternalReference::invoke_accessor_getter_callback(isolate()); |
| 5384 | 5375 |
| 5385 // +3 is to skip prolog, return address and name handle. | |
| 5386 Operand return_value_operand( | |
| 5387 ebp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | |
| 5388 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5376 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5389 thunk_last_arg, kStackUnwindSpace, nullptr, | 5377 ApiParameterOperand(2), kStackSpace, nullptr, |
| 5390 return_value_operand, NULL); | 5378 Operand(ebp, 7 * kPointerSize), NULL); |
| 5391 } | 5379 } |
| 5392 | 5380 |
| 5393 | 5381 |
| 5394 #undef __ | 5382 #undef __ |
| 5395 | 5383 |
| 5396 } // namespace internal | 5384 } // namespace internal |
| 5397 } // namespace v8 | 5385 } // namespace v8 |
| 5398 | 5386 |
| 5399 #endif // V8_TARGET_ARCH_X87 | 5387 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |