OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 __ CallExternalReference( | 410 __ CallExternalReference( |
411 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly)), | 411 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly)), |
412 5); | 412 5); |
413 } | 413 } |
414 | 414 |
415 | 415 |
416 // Number of pointers to be reserved on stack for fast API call. | 416 // Number of pointers to be reserved on stack for fast API call. |
417 static const int kFastApiCallArguments = 3; | 417 static const int kFastApiCallArguments = 3; |
418 | 418 |
419 | 419 |
420 // Reserves space for the extra arguments to FastHandleApiCall in the | 420 // Reserves space for the extra arguments to API function in the |
421 // caller's frame. | 421 // caller's frame. |
422 // | 422 // |
423 // These arguments are set by CheckPrototypes and GenerateFastApiCall. | 423 // These arguments are set by CheckPrototypes and GenerateFastApiCall. |
424 static void ReserveSpaceForFastApiCall(MacroAssembler* masm, Register scratch) { | 424 static void ReserveSpaceForFastApiCall(MacroAssembler* masm, Register scratch) { |
425 // ----------- S t a t e ------------- | 425 // ----------- S t a t e ------------- |
426 // -- esp[0] : return address | 426 // -- esp[0] : return address |
427 // -- esp[4] : last argument in the internal frame of the caller | 427 // -- esp[4] : last argument in the internal frame of the caller |
428 // ----------------------------------- | 428 // ----------------------------------- |
429 __ pop(scratch); | 429 __ pop(scratch); |
430 for (int i = 0; i < kFastApiCallArguments; i++) { | 430 for (int i = 0; i < kFastApiCallArguments; i++) { |
(...skipping 12 matching lines...) Expand all Loading... |
443 // -- esp[kFastApiCallArguments * 4] : first fast api call extra argument. | 443 // -- esp[kFastApiCallArguments * 4] : first fast api call extra argument. |
444 // -- esp[kFastApiCallArguments * 4 + 4] : last argument in the internal | 444 // -- esp[kFastApiCallArguments * 4 + 4] : last argument in the internal |
445 // frame. | 445 // frame. |
446 // ----------------------------------- | 446 // ----------------------------------- |
447 __ pop(scratch); | 447 __ pop(scratch); |
448 __ add(Operand(esp), Immediate(kPointerSize * kFastApiCallArguments)); | 448 __ add(Operand(esp), Immediate(kPointerSize * kFastApiCallArguments)); |
449 __ push(scratch); | 449 __ push(scratch); |
450 } | 450 } |
451 | 451 |
452 | 452 |
453 // Generates call to FastHandleApiCall builtin. | 453 // Generates call to API function. |
454 static bool GenerateFastApiCall(MacroAssembler* masm, | 454 static bool GenerateFastApiCall(MacroAssembler* masm, |
455 const CallOptimization& optimization, | 455 const CallOptimization& optimization, |
456 int argc, | 456 int argc, |
457 Failure** failure) { | 457 Failure** failure) { |
458 // ----------- S t a t e ------------- | 458 // ----------- S t a t e ------------- |
459 // -- esp[0] : return address | 459 // -- esp[0] : return address |
460 // -- esp[4] : object passing the type check | 460 // -- esp[4] : object passing the type check |
461 // (last fast api call extra argument, | 461 // (last fast api call extra argument, |
462 // set by CheckPrototypes) | 462 // set by CheckPrototypes) |
463 // -- esp[8] : api function | 463 // -- esp[8] : api function |
464 // (first fast api call extra argument) | 464 // (first fast api call extra argument) |
465 // -- esp[12] : api call data | 465 // -- esp[12] : api call data |
466 // -- esp[16] : last argument | 466 // -- esp[16] : last argument |
467 // -- ... | 467 // -- ... |
468 // -- esp[(argc + 3) * 4] : first argument | 468 // -- esp[(argc + 3) * 4] : first argument |
469 // -- esp[(argc + 4) * 4] : receiver | 469 // -- esp[(argc + 4) * 4] : receiver |
470 // ----------------------------------- | 470 // ----------------------------------- |
471 // Get the function and setup the context. | 471 // Get the function and setup the context. |
472 JSFunction* function = optimization.constant_function(); | 472 JSFunction* function = optimization.constant_function(); |
473 __ mov(edi, Immediate(Handle<JSFunction>(function))); | 473 __ mov(edi, Immediate(Handle<JSFunction>(function))); |
474 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 474 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
475 | 475 |
476 // Pass the additional arguments FastHandleApiCall expects. | 476 // Pass the additional arguments. |
477 __ mov(Operand(esp, 2 * kPointerSize), edi); | 477 __ mov(Operand(esp, 2 * kPointerSize), edi); |
478 Object* call_data = optimization.api_call_info()->data(); | 478 Object* call_data = optimization.api_call_info()->data(); |
479 Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info()); | 479 Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info()); |
480 if (Heap::InNewSpace(call_data)) { | 480 if (Heap::InNewSpace(call_data)) { |
481 __ mov(ecx, api_call_info_handle); | 481 __ mov(ecx, api_call_info_handle); |
482 __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset)); | 482 __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset)); |
483 __ mov(Operand(esp, 3 * kPointerSize), ebx); | 483 __ mov(Operand(esp, 3 * kPointerSize), ebx); |
484 } else { | 484 } else { |
485 __ mov(Operand(esp, 3 * kPointerSize), | 485 __ mov(Operand(esp, 3 * kPointerSize), |
486 Immediate(Handle<Object>(call_data))); | 486 Immediate(Handle<Object>(call_data))); |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 ASSERT(callback != NULL); | 1256 ASSERT(callback != NULL); |
1257 ASSERT(callback->getter() != NULL); | 1257 ASSERT(callback->getter() != NULL); |
1258 | 1258 |
1259 // Tail call to runtime. | 1259 // Tail call to runtime. |
1260 // Important invariant in CALLBACKS case: the code above must be | 1260 // Important invariant in CALLBACKS case: the code above must be |
1261 // structured to never clobber |receiver| register. | 1261 // structured to never clobber |receiver| register. |
1262 __ pop(scratch2); // return address | 1262 __ pop(scratch2); // return address |
1263 __ push(receiver); | 1263 __ push(receiver); |
1264 __ push(holder_reg); | 1264 __ push(holder_reg); |
1265 __ mov(holder_reg, Immediate(Handle<AccessorInfo>(callback))); | 1265 __ mov(holder_reg, Immediate(Handle<AccessorInfo>(callback))); |
| 1266 __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset)); |
1266 __ push(holder_reg); | 1267 __ push(holder_reg); |
1267 __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset)); | |
1268 __ push(name_reg); | 1268 __ push(name_reg); |
1269 __ push(scratch2); // restore return address | 1269 __ push(scratch2); // restore return address |
1270 | 1270 |
1271 ExternalReference ref = | 1271 ExternalReference ref = |
1272 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 1272 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); |
1273 __ TailCallExternalReference(ref, 5, 1); | 1273 __ TailCallExternalReference(ref, 5, 1); |
1274 } | 1274 } |
1275 } else { // !compile_followup_inline | 1275 } else { // !compile_followup_inline |
1276 // Call the runtime system to load the interceptor. | 1276 // Call the runtime system to load the interceptor. |
1277 // Check that the maps haven't changed. | 1277 // Check that the maps haven't changed. |
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 // Return the generated code. | 3155 // Return the generated code. |
3156 return GetCode(); | 3156 return GetCode(); |
3157 } | 3157 } |
3158 | 3158 |
3159 | 3159 |
3160 #undef __ | 3160 #undef __ |
3161 | 3161 |
3162 } } // namespace v8::internal | 3162 } } // namespace v8::internal |
3163 | 3163 |
3164 #endif // V8_TARGET_ARCH_IA32 | 3164 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |