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

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

Issue 23620036: Refactoring PropertyCallbackInfo & FunctionCallbackInfo, step 1. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix register allocation Created 7 years, 3 months 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/arm/stub-cache-arm.cc ('k') | src/stub-cache.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 385 }
386 __ mov(dst, FieldOperand(src, offset)); 386 __ mov(dst, FieldOperand(src, offset));
387 } 387 }
388 388
389 389
390 static void PushInterceptorArguments(MacroAssembler* masm, 390 static void PushInterceptorArguments(MacroAssembler* masm,
391 Register receiver, 391 Register receiver,
392 Register holder, 392 Register holder,
393 Register name, 393 Register name,
394 Handle<JSObject> holder_obj) { 394 Handle<JSObject> holder_obj) {
395 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0);
396 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1);
397 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2);
398 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3);
399 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4);
395 __ push(name); 400 __ push(name);
396 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); 401 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor());
397 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); 402 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor));
398 Register scratch = name; 403 Register scratch = name;
399 __ mov(scratch, Immediate(interceptor)); 404 __ mov(scratch, Immediate(interceptor));
400 __ push(scratch); 405 __ push(scratch);
401 __ push(receiver); 406 __ push(receiver);
402 __ push(holder); 407 __ push(holder);
403 __ push(FieldOperand(scratch, InterceptorInfo::kDataOffset));
404 __ push(Immediate(reinterpret_cast<int>(masm->isolate())));
405 } 408 }
406 409
407 410
408 static void CompileCallLoadPropertyWithInterceptor( 411 static void CompileCallLoadPropertyWithInterceptor(
409 MacroAssembler* masm, 412 MacroAssembler* masm,
410 Register receiver, 413 Register receiver,
411 Register holder, 414 Register holder,
412 Register name, 415 Register name,
413 Handle<JSObject> holder_obj) { 416 Handle<JSObject> holder_obj) {
414 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 417 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
415 __ CallExternalReference( 418 __ CallExternalReference(
416 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), 419 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly),
417 masm->isolate()), 420 masm->isolate()),
418 6); 421 StubCache::kInterceptorArgsLength);
419 } 422 }
420 423
421 424
422 // Number of pointers to be reserved on stack for fast API call. 425 // Number of pointers to be reserved on stack for fast API call.
423 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; 426 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength;
424 427
425 428
426 // Reserves space for the extra arguments to API function in the 429 // Reserves space for the extra arguments to API function in the
427 // caller's frame. 430 // caller's frame.
428 // 431 //
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 729
727 FrameScope scope(masm, StackFrame::INTERNAL); 730 FrameScope scope(masm, StackFrame::INTERNAL);
728 // Save the name_ register across the call. 731 // Save the name_ register across the call.
729 __ push(name_); 732 __ push(name_);
730 733
731 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); 734 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder);
732 735
733 __ CallExternalReference( 736 __ CallExternalReference(
734 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), 737 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall),
735 masm->isolate()), 738 masm->isolate()),
736 6); 739 StubCache::kInterceptorArgsLength);
737 740
738 // Restore the name_ register. 741 // Restore the name_ register.
739 __ pop(name_); 742 __ pop(name_);
740 743
741 // Leave the internal frame. 744 // Leave the internal frame.
742 } 745 }
743 746
744 void LoadWithInterceptor(MacroAssembler* masm, 747 void LoadWithInterceptor(MacroAssembler* masm,
745 Register receiver, 748 Register receiver,
746 Register holder, 749 Register holder,
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 } 1397 }
1395 1398
1396 1399
1397 void BaseLoadStubCompiler::GenerateLoadCallback( 1400 void BaseLoadStubCompiler::GenerateLoadCallback(
1398 Register reg, 1401 Register reg,
1399 Handle<ExecutableAccessorInfo> callback) { 1402 Handle<ExecutableAccessorInfo> callback) {
1400 // Insert additional parameters into the stack frame above return address. 1403 // Insert additional parameters into the stack frame above return address.
1401 ASSERT(!scratch3().is(reg)); 1404 ASSERT(!scratch3().is(reg));
1402 __ pop(scratch3()); // Get return address to place it below. 1405 __ pop(scratch3()); // Get return address to place it below.
1403 1406
1407 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 0);
1408 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == -1);
1409 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == -2);
1410 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == -3);
1411 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == -4);
1412 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == -5);
1404 __ push(receiver()); // receiver 1413 __ push(receiver()); // receiver
1405 __ mov(scratch2(), esp); 1414 __ mov(scratch2(), esp);
1406 ASSERT(!scratch2().is(reg)); 1415 ASSERT(!scratch2().is(reg));
1407 __ push(reg); // holder
1408 // Push data from ExecutableAccessorInfo. 1416 // Push data from ExecutableAccessorInfo.
1409 if (isolate()->heap()->InNewSpace(callback->data())) { 1417 if (isolate()->heap()->InNewSpace(callback->data())) {
1410 __ mov(scratch1(), Immediate(callback)); 1418 Register scratch = reg.is(scratch1()) ? receiver() : scratch1();
1411 __ push(FieldOperand(scratch1(), ExecutableAccessorInfo::kDataOffset)); 1419 __ mov(scratch, Immediate(callback));
1420 __ push(FieldOperand(scratch, ExecutableAccessorInfo::kDataOffset));
1412 } else { 1421 } else {
1413 __ push(Immediate(Handle<Object>(callback->data(), isolate()))); 1422 __ push(Immediate(Handle<Object>(callback->data(), isolate())));
1414 } 1423 }
1415 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue 1424 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue
1416 // ReturnValue default value 1425 // ReturnValue default value
1417 __ push(Immediate(isolate()->factory()->undefined_value())); 1426 __ push(Immediate(isolate()->factory()->undefined_value()));
1418 __ push(Immediate(reinterpret_cast<int>(isolate()))); 1427 __ push(Immediate(reinterpret_cast<int>(isolate())));
1428 __ push(reg); // holder
1419 1429
1420 // Save a pointer to where we pushed the arguments pointer. This will be 1430 // Save a pointer to where we pushed the arguments pointer. This will be
1421 // passed as the const ExecutableAccessorInfo& to the C++ callback. 1431 // passed as the const ExecutableAccessorInfo& to the C++ callback.
1422 __ push(scratch2()); 1432 __ push(scratch2());
1423 1433
1424 __ push(name()); // name 1434 __ push(name()); // name
1425 __ mov(ebx, esp); // esp points to reference to name (handler). 1435 __ mov(ebx, esp); // esp points to reference to name (handler).
1426 1436
1427 __ push(scratch3()); // Restore return address. 1437 __ push(scratch3()); // Restore return address.
1428 1438
(...skipping 14 matching lines...) Expand all
1443 // already generated). Do not allow the assembler to perform a 1453 // already generated). Do not allow the assembler to perform a
1444 // garbage collection but instead return the allocation failure 1454 // garbage collection but instead return the allocation failure
1445 // object. 1455 // object.
1446 1456
1447 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); 1457 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1448 1458
1449 __ CallApiFunctionAndReturn(getter_address, 1459 __ CallApiFunctionAndReturn(getter_address,
1450 thunk_address, 1460 thunk_address,
1451 ApiParameterOperand(2), 1461 ApiParameterOperand(2),
1452 kStackSpace, 1462 kStackSpace,
1453 6); 1463 7);
1454 } 1464 }
1455 1465
1456 1466
1457 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 1467 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
1458 // Return the constant value. 1468 // Return the constant value.
1459 __ LoadObject(eax, value); 1469 __ LoadObject(eax, value);
1460 __ ret(0); 1470 __ ret(0);
1461 } 1471 }
1462 1472
1463 1473
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 // Call the runtime system to load the interceptor. 1560 // Call the runtime system to load the interceptor.
1551 // Check that the maps haven't changed. 1561 // Check that the maps haven't changed.
1552 __ pop(scratch2()); // save old return address 1562 __ pop(scratch2()); // save old return address
1553 PushInterceptorArguments(masm(), receiver(), holder_reg, 1563 PushInterceptorArguments(masm(), receiver(), holder_reg,
1554 this->name(), interceptor_holder); 1564 this->name(), interceptor_holder);
1555 __ push(scratch2()); // restore old return address 1565 __ push(scratch2()); // restore old return address
1556 1566
1557 ExternalReference ref = 1567 ExternalReference ref =
1558 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), 1568 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad),
1559 isolate()); 1569 isolate());
1560 __ TailCallExternalReference(ref, 6, 1); 1570 __ TailCallExternalReference(ref, StubCache::kInterceptorArgsLength, 1);
1561 } 1571 }
1562 } 1572 }
1563 1573
1564 1574
1565 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { 1575 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) {
1566 if (kind_ == Code::KEYED_CALL_IC) { 1576 if (kind_ == Code::KEYED_CALL_IC) {
1567 __ cmp(ecx, Immediate(name)); 1577 __ cmp(ecx, Immediate(name));
1568 __ j(not_equal, miss); 1578 __ j(not_equal, miss);
1569 } 1579 }
1570 } 1580 }
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
3258 // ----------------------------------- 3268 // -----------------------------------
3259 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3269 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3260 } 3270 }
3261 3271
3262 3272
3263 #undef __ 3273 #undef __
3264 3274
3265 } } // namespace v8::internal 3275 } } // namespace v8::internal
3266 3276
3267 #endif // V8_TARGET_ARCH_IA32 3277 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698