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

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

Issue 10069050: Add isolate accessor to AccessorInfo and Arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Daniel Clifford. Created 8 years, 8 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/arguments.h ('k') | src/builtins.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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 __ push(name); 573 __ push(name);
574 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); 574 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor());
575 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); 575 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor));
576 Register scratch = name; 576 Register scratch = name;
577 __ mov(scratch, Operand(interceptor)); 577 __ mov(scratch, Operand(interceptor));
578 __ push(scratch); 578 __ push(scratch);
579 __ push(receiver); 579 __ push(receiver);
580 __ push(holder); 580 __ push(holder);
581 __ ldr(scratch, FieldMemOperand(scratch, InterceptorInfo::kDataOffset)); 581 __ ldr(scratch, FieldMemOperand(scratch, InterceptorInfo::kDataOffset));
582 __ push(scratch); 582 __ push(scratch);
583 __ mov(scratch, Operand(ExternalReference::isolate_address()));
584 __ push(scratch);
583 } 585 }
584 586
585 587
586 static void CompileCallLoadPropertyWithInterceptor( 588 static void CompileCallLoadPropertyWithInterceptor(
587 MacroAssembler* masm, 589 MacroAssembler* masm,
588 Register receiver, 590 Register receiver,
589 Register holder, 591 Register holder,
590 Register name, 592 Register name,
591 Handle<JSObject> holder_obj) { 593 Handle<JSObject> holder_obj) {
592 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 594 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
593 595
594 ExternalReference ref = 596 ExternalReference ref =
595 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), 597 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly),
596 masm->isolate()); 598 masm->isolate());
597 __ mov(r0, Operand(5)); 599 __ mov(r0, Operand(6));
598 __ mov(r1, Operand(ref)); 600 __ mov(r1, Operand(ref));
599 601
600 CEntryStub stub(1); 602 CEntryStub stub(1);
601 __ CallStub(&stub); 603 __ CallStub(&stub);
602 } 604 }
603 605
604 606
605 static const int kFastApiCallArguments = 3; 607 static const int kFastApiCallArguments = 4;
606 608
607 // Reserves space for the extra arguments to FastHandleApiCall in the 609 // Reserves space for the extra arguments to API function in the
608 // caller's frame. 610 // caller's frame.
609 // 611 //
610 // These arguments are set by CheckPrototypes and GenerateFastApiDirectCall. 612 // These arguments are set by CheckPrototypes and GenerateFastApiDirectCall.
611 static void ReserveSpaceForFastApiCall(MacroAssembler* masm, 613 static void ReserveSpaceForFastApiCall(MacroAssembler* masm,
612 Register scratch) { 614 Register scratch) {
613 __ mov(scratch, Operand(Smi::FromInt(0))); 615 __ mov(scratch, Operand(Smi::FromInt(0)));
614 for (int i = 0; i < kFastApiCallArguments; i++) { 616 for (int i = 0; i < kFastApiCallArguments; i++) {
615 __ push(scratch); 617 __ push(scratch);
616 } 618 }
617 } 619 }
618 620
619 621
620 // Undoes the effects of ReserveSpaceForFastApiCall. 622 // Undoes the effects of ReserveSpaceForFastApiCall.
621 static void FreeSpaceForFastApiCall(MacroAssembler* masm) { 623 static void FreeSpaceForFastApiCall(MacroAssembler* masm) {
622 __ Drop(kFastApiCallArguments); 624 __ Drop(kFastApiCallArguments);
623 } 625 }
624 626
625 627
626 static void GenerateFastApiDirectCall(MacroAssembler* masm, 628 static void GenerateFastApiDirectCall(MacroAssembler* masm,
627 const CallOptimization& optimization, 629 const CallOptimization& optimization,
628 int argc) { 630 int argc) {
629 // ----------- S t a t e ------------- 631 // ----------- S t a t e -------------
630 // -- sp[0] : holder (set by CheckPrototypes) 632 // -- sp[0] : holder (set by CheckPrototypes)
631 // -- sp[4] : callee JS function 633 // -- sp[4] : callee JS function
632 // -- sp[8] : call data 634 // -- sp[8] : call data
633 // -- sp[12] : last JS argument 635 // -- sp[12] : isolate
636 // -- sp[16] : last JS argument
634 // -- ... 637 // -- ...
635 // -- sp[(argc + 3) * 4] : first JS argument 638 // -- sp[(argc + 3) * 4] : first JS argument
636 // -- sp[(argc + 4) * 4] : receiver 639 // -- sp[(argc + 4) * 4] : receiver
637 // ----------------------------------- 640 // -----------------------------------
638 // Get the function and setup the context. 641 // Get the function and setup the context.
639 Handle<JSFunction> function = optimization.constant_function(); 642 Handle<JSFunction> function = optimization.constant_function();
640 __ LoadHeapObject(r5, function); 643 __ LoadHeapObject(r5, function);
641 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset)); 644 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset));
642 645
643 // Pass the additional arguments FastHandleApiCall expects. 646 // Pass the additional arguments.
644 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 647 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
645 Handle<Object> call_data(api_call_info->data()); 648 Handle<Object> call_data(api_call_info->data());
646 if (masm->isolate()->heap()->InNewSpace(*call_data)) { 649 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
647 __ Move(r0, api_call_info); 650 __ Move(r0, api_call_info);
648 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); 651 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset));
649 } else { 652 } else {
650 __ Move(r6, call_data); 653 __ Move(r6, call_data);
651 } 654 }
652 // Store JS function and call data. 655 __ mov(r7, Operand(ExternalReference::isolate_address()));
653 __ stm(ib, sp, r5.bit() | r6.bit()); 656 // Store JS function, call data and isolate.
657 __ stm(ib, sp, r5.bit() | r6.bit() | r7.bit());
654 658
655 // r2 points to call data as expected by Arguments 659 // Prepare arguments.
656 // (refer to layout above). 660 __ add(r2, sp, Operand(3 * kPointerSize));
657 __ add(r2, sp, Operand(2 * kPointerSize));
658 661
662 // Allocate the v8::Arguments structure in the arguments' space since
663 // it's not controlled by GC.
659 const int kApiStackSpace = 4; 664 const int kApiStackSpace = 4;
660 665
661 FrameScope frame_scope(masm, StackFrame::MANUAL); 666 FrameScope frame_scope(masm, StackFrame::MANUAL);
662 __ EnterExitFrame(false, kApiStackSpace); 667 __ EnterExitFrame(false, kApiStackSpace);
663 668
664 // r0 = v8::Arguments& 669 // r0 = v8::Arguments&
665 // Arguments is after the return address. 670 // Arguments is after the return address.
666 __ add(r0, sp, Operand(1 * kPointerSize)); 671 __ add(r0, sp, Operand(1 * kPointerSize));
667 // v8::Arguments::implicit_args = data 672 // v8::Arguments::implicit_args_
668 __ str(r2, MemOperand(r0, 0 * kPointerSize)); 673 __ str(r2, MemOperand(r0, 0 * kPointerSize));
669 // v8::Arguments::values = last argument 674 // v8::Arguments::values_
670 __ add(ip, r2, Operand(argc * kPointerSize)); 675 __ add(ip, r2, Operand(argc * kPointerSize));
671 __ str(ip, MemOperand(r0, 1 * kPointerSize)); 676 __ str(ip, MemOperand(r0, 1 * kPointerSize));
672 // v8::Arguments::length_ = argc 677 // v8::Arguments::length_ = argc
673 __ mov(ip, Operand(argc)); 678 __ mov(ip, Operand(argc));
674 __ str(ip, MemOperand(r0, 2 * kPointerSize)); 679 __ str(ip, MemOperand(r0, 2 * kPointerSize));
675 // v8::Arguments::is_construct_call = 0 680 // v8::Arguments::is_construct_call = 0
676 __ mov(ip, Operand(0)); 681 __ mov(ip, Operand(0));
677 __ str(ip, MemOperand(r0, 3 * kPointerSize)); 682 __ str(ip, MemOperand(r0, 3 * kPointerSize));
678 683
679 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; 684 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 name, miss_label); 841 name, miss_label);
837 842
838 // Call a runtime function to load the interceptor property. 843 // Call a runtime function to load the interceptor property.
839 FrameScope scope(masm, StackFrame::INTERNAL); 844 FrameScope scope(masm, StackFrame::INTERNAL);
840 // Save the name_ register across the call. 845 // Save the name_ register across the call.
841 __ push(name_); 846 __ push(name_);
842 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); 847 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder);
843 __ CallExternalReference( 848 __ CallExternalReference(
844 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), 849 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall),
845 masm->isolate()), 850 masm->isolate()),
846 5); 851 6);
847 // Restore the name_ register. 852 // Restore the name_ register.
848 __ pop(name_); 853 __ pop(name_);
849 // Leave the internal frame. 854 // Leave the internal frame.
850 } 855 }
851 856
852 void LoadWithInterceptor(MacroAssembler* masm, 857 void LoadWithInterceptor(MacroAssembler* masm,
853 Register receiver, 858 Register receiver,
854 Register holder, 859 Register holder,
855 Handle<JSObject> holder_obj, 860 Handle<JSObject> holder_obj,
856 Register scratch, 861 Register scratch,
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 // Build AccessorInfo::args_ list on the stack and push property name below 1200 // Build AccessorInfo::args_ list on the stack and push property name below
1196 // the exit frame to make GC aware of them and store pointers to them. 1201 // the exit frame to make GC aware of them and store pointers to them.
1197 __ push(receiver); 1202 __ push(receiver);
1198 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ 1203 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_
1199 if (heap()->InNewSpace(callback->data())) { 1204 if (heap()->InNewSpace(callback->data())) {
1200 __ Move(scratch3, callback); 1205 __ Move(scratch3, callback);
1201 __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); 1206 __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset));
1202 } else { 1207 } else {
1203 __ Move(scratch3, Handle<Object>(callback->data())); 1208 __ Move(scratch3, Handle<Object>(callback->data()));
1204 } 1209 }
1205 __ Push(reg, scratch3, name_reg); 1210 __ Push(reg, scratch3);
1211 __ mov(scratch3, Operand(ExternalReference::isolate_address()));
1212 __ Push(scratch3, name_reg);
1206 __ mov(r0, sp); // r0 = Handle<String> 1213 __ mov(r0, sp); // r0 = Handle<String>
1207 1214
1208 const int kApiStackSpace = 1; 1215 const int kApiStackSpace = 1;
1209 FrameScope frame_scope(masm(), StackFrame::MANUAL); 1216 FrameScope frame_scope(masm(), StackFrame::MANUAL);
1210 __ EnterExitFrame(false, kApiStackSpace); 1217 __ EnterExitFrame(false, kApiStackSpace);
1211 1218
1212 // Create AccessorInfo instance on the stack above the exit frame with 1219 // Create AccessorInfo instance on the stack above the exit frame with
1213 // scratch2 (internal::Object** args_) as the data. 1220 // scratch2 (internal::Object** args_) as the data.
1214 __ str(scratch2, MemOperand(sp, 1 * kPointerSize)); 1221 __ str(scratch2, MemOperand(sp, 1 * kPointerSize));
1215 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& 1222 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo&
1216 1223
1217 const int kStackUnwindSpace = 4; 1224 const int kStackUnwindSpace = 5;
1218 Address getter_address = v8::ToCData<Address>(callback->getter()); 1225 Address getter_address = v8::ToCData<Address>(callback->getter());
1219 ApiFunction fun(getter_address); 1226 ApiFunction fun(getter_address);
1220 ExternalReference ref = 1227 ExternalReference ref =
1221 ExternalReference(&fun, 1228 ExternalReference(&fun,
1222 ExternalReference::DIRECT_GETTER_CALL, 1229 ExternalReference::DIRECT_GETTER_CALL,
1223 masm()->isolate()); 1230 masm()->isolate());
1224 __ CallApiFunctionAndReturn(ref, kStackUnwindSpace); 1231 __ CallApiFunctionAndReturn(ref, kStackUnwindSpace);
1225 } 1232 }
1226 1233
1227 1234
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 ASSERT(callback->getter() != NULL); 1335 ASSERT(callback->getter() != NULL);
1329 1336
1330 // Tail call to runtime. 1337 // Tail call to runtime.
1331 // Important invariant in CALLBACKS case: the code above must be 1338 // Important invariant in CALLBACKS case: the code above must be
1332 // structured to never clobber |receiver| register. 1339 // structured to never clobber |receiver| register.
1333 __ Move(scratch2, callback); 1340 __ Move(scratch2, callback);
1334 // holder_reg is either receiver or scratch1. 1341 // holder_reg is either receiver or scratch1.
1335 if (!receiver.is(holder_reg)) { 1342 if (!receiver.is(holder_reg)) {
1336 ASSERT(scratch1.is(holder_reg)); 1343 ASSERT(scratch1.is(holder_reg));
1337 __ Push(receiver, holder_reg); 1344 __ Push(receiver, holder_reg);
1338 __ ldr(scratch3,
1339 FieldMemOperand(scratch2, AccessorInfo::kDataOffset));
1340 __ Push(scratch3, scratch2, name_reg);
1341 } else { 1345 } else {
1342 __ push(receiver); 1346 __ push(receiver);
1343 __ ldr(scratch3, 1347 __ push(holder_reg);
1344 FieldMemOperand(scratch2, AccessorInfo::kDataOffset));
1345 __ Push(holder_reg, scratch3, scratch2, name_reg);
1346 } 1348 }
1349 __ ldr(scratch3,
1350 FieldMemOperand(scratch2, AccessorInfo::kDataOffset));
1351 __ mov(scratch1, Operand(ExternalReference::isolate_address()));
1352 __ Push(scratch3, scratch1, scratch2, name_reg);
1347 1353
1348 ExternalReference ref = 1354 ExternalReference ref =
1349 ExternalReference(IC_Utility(IC::kLoadCallbackProperty), 1355 ExternalReference(IC_Utility(IC::kLoadCallbackProperty),
1350 masm()->isolate()); 1356 masm()->isolate());
1351 __ TailCallExternalReference(ref, 5, 1); 1357 __ TailCallExternalReference(ref, 6, 1);
1352 } 1358 }
1353 } else { // !compile_followup_inline 1359 } else { // !compile_followup_inline
1354 // Call the runtime system to load the interceptor. 1360 // Call the runtime system to load the interceptor.
1355 // Check that the maps haven't changed. 1361 // Check that the maps haven't changed.
1356 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, 1362 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder,
1357 scratch1, scratch2, scratch3, 1363 scratch1, scratch2, scratch3,
1358 name, miss); 1364 name, miss);
1359 PushInterceptorArguments(masm(), receiver, holder_reg, 1365 PushInterceptorArguments(masm(), receiver, holder_reg,
1360 name_reg, interceptor_holder); 1366 name_reg, interceptor_holder);
1361 1367
1362 ExternalReference ref = 1368 ExternalReference ref =
1363 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), 1369 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad),
1364 masm()->isolate()); 1370 masm()->isolate());
1365 __ TailCallExternalReference(ref, 5, 1); 1371 __ TailCallExternalReference(ref, 6, 1);
1366 } 1372 }
1367 } 1373 }
1368 1374
1369 1375
1370 void CallStubCompiler::GenerateNameCheck(Handle<String> name, Label* miss) { 1376 void CallStubCompiler::GenerateNameCheck(Handle<String> name, Label* miss) {
1371 if (kind_ == Code::KEYED_CALL_IC) { 1377 if (kind_ == Code::KEYED_CALL_IC) {
1372 __ cmp(r2, Operand(name)); 1378 __ cmp(r2, Operand(name));
1373 __ b(ne, miss); 1379 __ b(ne, miss);
1374 } 1380 }
1375 } 1381 }
(...skipping 3110 matching lines...) Expand 10 before | Expand all | Expand 10 after
4486 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4492 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4487 } 4493 }
4488 } 4494 }
4489 4495
4490 4496
4491 #undef __ 4497 #undef __
4492 4498
4493 } } // namespace v8::internal 4499 } } // namespace v8::internal
4494 4500
4495 #endif // V8_TARGET_ARCH_ARM 4501 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arguments.h ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698