Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 5274002: Version 2.5.8... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 Register scratch2, 1134 Register scratch2,
1135 Register scratch3, 1135 Register scratch3,
1136 Object* value, 1136 Object* value,
1137 String* name, 1137 String* name,
1138 Label* miss) { 1138 Label* miss) {
1139 // Check that the receiver isn't a smi. 1139 // Check that the receiver isn't a smi.
1140 __ test(receiver, Immediate(kSmiTagMask)); 1140 __ test(receiver, Immediate(kSmiTagMask));
1141 __ j(zero, miss, not_taken); 1141 __ j(zero, miss, not_taken);
1142 1142
1143 // Check that the maps haven't changed. 1143 // Check that the maps haven't changed.
1144 Register reg = 1144 CheckPrototypes(object, receiver, holder,
1145 CheckPrototypes(object, receiver, holder, 1145 scratch1, scratch2, scratch3, name, miss);
1146 scratch1, scratch2, scratch3, name, miss);
1147 1146
1148 // Return the constant value. 1147 // Return the constant value.
1149 __ mov(eax, Handle<Object>(value)); 1148 __ mov(eax, Handle<Object>(value));
1150 __ ret(0); 1149 __ ret(0);
1151 } 1150 }
1152 1151
1153 1152
1154 void StubCompiler::GenerateLoadInterceptor(JSObject* object, 1153 void StubCompiler::GenerateLoadInterceptor(JSObject* object,
1155 JSObject* interceptor_holder, 1154 JSObject* interceptor_holder,
1156 LookupResult* lookup, 1155 LookupResult* lookup,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 ASSERT(callback != NULL); 1255 ASSERT(callback != NULL);
1257 ASSERT(callback->getter() != NULL); 1256 ASSERT(callback->getter() != NULL);
1258 1257
1259 // Tail call to runtime. 1258 // Tail call to runtime.
1260 // Important invariant in CALLBACKS case: the code above must be 1259 // Important invariant in CALLBACKS case: the code above must be
1261 // structured to never clobber |receiver| register. 1260 // structured to never clobber |receiver| register.
1262 __ pop(scratch2); // return address 1261 __ pop(scratch2); // return address
1263 __ push(receiver); 1262 __ push(receiver);
1264 __ push(holder_reg); 1263 __ push(holder_reg);
1265 __ mov(holder_reg, Immediate(Handle<AccessorInfo>(callback))); 1264 __ mov(holder_reg, Immediate(Handle<AccessorInfo>(callback)));
1265 __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset));
1266 __ push(holder_reg); 1266 __ push(holder_reg);
1267 __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset));
1268 __ push(name_reg); 1267 __ push(name_reg);
1269 __ push(scratch2); // restore return address 1268 __ push(scratch2); // restore return address
1270 1269
1271 ExternalReference ref = 1270 ExternalReference ref =
1272 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); 1271 ExternalReference(IC_Utility(IC::kLoadCallbackProperty));
1273 __ TailCallExternalReference(ref, 5, 1); 1272 __ TailCallExternalReference(ref, 5, 1);
1274 } 1273 }
1275 } else { // !compile_followup_inline 1274 } else { // !compile_followup_inline
1276 // Call the runtime system to load the interceptor. 1275 // Call the runtime system to load the interceptor.
1277 // Check that the maps haven't changed. 1276 // Check that the maps haven't changed.
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2311 holder, 2310 holder,
2312 name, 2311 name,
2313 &lookup, 2312 &lookup,
2314 edx, 2313 edx,
2315 ebx, 2314 ebx,
2316 edi, 2315 edi,
2317 eax, 2316 eax,
2318 &miss, 2317 &miss,
2319 &failure); 2318 &failure);
2320 if (!success) { 2319 if (!success) {
2321 return false; 2320 return failure;
2322 } 2321 }
2323 2322
2324 // Restore receiver. 2323 // Restore receiver.
2325 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); 2324 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
2326 2325
2327 // Check that the function really is a function. 2326 // Check that the function really is a function.
2328 __ test(eax, Immediate(kSmiTagMask)); 2327 __ test(eax, Immediate(kSmiTagMask));
2329 __ j(zero, &miss, not_taken); 2328 __ j(zero, &miss, not_taken);
2330 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); 2329 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
2331 __ j(not_equal, &miss, not_taken); 2330 __ j(not_equal, &miss, not_taken);
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 // Return the generated code. 3154 // Return the generated code.
3156 return GetCode(); 3155 return GetCode();
3157 } 3156 }
3158 3157
3159 3158
3160 #undef __ 3159 #undef __
3161 3160
3162 } } // namespace v8::internal 3161 } } // namespace v8::internal
3163 3162
3164 #endif // V8_TARGET_ARCH_IA32 3163 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698