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

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

Issue 153913002: A64: Synchronize with r16756. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/lithium-codegen-arm.cc ('k') | src/array.js » ('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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 373
374 374
375 // Generate code to load the length from a string object and return the length. 375 // Generate code to load the length from a string object and return the length.
376 // If the receiver object is not a string or a wrapped string object the 376 // If the receiver object is not a string or a wrapped string object the
377 // execution continues at the miss label. The register containing the 377 // execution continues at the miss label. The register containing the
378 // receiver is potentially clobbered. 378 // receiver is potentially clobbered.
379 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, 379 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm,
380 Register receiver, 380 Register receiver,
381 Register scratch1, 381 Register scratch1,
382 Register scratch2, 382 Register scratch2,
383 Label* miss, 383 Label* miss) {
384 bool support_wrappers) {
385 Label check_wrapper; 384 Label check_wrapper;
386 385
387 // Check if the object is a string leaving the instance type in the 386 // Check if the object is a string leaving the instance type in the
388 // scratch1 register. 387 // scratch1 register.
389 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, 388 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, &check_wrapper);
390 support_wrappers ? &check_wrapper : miss);
391 389
392 // Load length directly from the string. 390 // Load length directly from the string.
393 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); 391 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset));
394 __ Ret(); 392 __ Ret();
395 393
396 if (support_wrappers) { 394 // Check if the object is a JSValue wrapper.
397 // Check if the object is a JSValue wrapper. 395 __ bind(&check_wrapper);
398 __ bind(&check_wrapper); 396 __ cmp(scratch1, Operand(JS_VALUE_TYPE));
399 __ cmp(scratch1, Operand(JS_VALUE_TYPE)); 397 __ b(ne, miss);
400 __ b(ne, miss);
401 398
402 // Unwrap the value and check if the wrapped value is a string. 399 // Unwrap the value and check if the wrapped value is a string.
403 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); 400 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset));
404 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); 401 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss);
405 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset)); 402 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset));
406 __ Ret(); 403 __ Ret();
407 }
408 } 404 }
409 405
410 406
411 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, 407 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
412 Register receiver, 408 Register receiver,
413 Register scratch1, 409 Register scratch1,
414 Register scratch2, 410 Register scratch2,
415 Label* miss_label) { 411 Label* miss_label) {
416 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 412 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
417 __ mov(r0, scratch1); 413 __ mov(r0, scratch1);
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 : CALL_AS_METHOD; 774 : CALL_AS_METHOD;
779 __ InvokeFunction(r1, arguments, JUMP_FUNCTION, NullCallWrapper(), call_kind); 775 __ InvokeFunction(r1, arguments, JUMP_FUNCTION, NullCallWrapper(), call_kind);
780 } 776 }
781 777
782 778
783 static void PushInterceptorArguments(MacroAssembler* masm, 779 static void PushInterceptorArguments(MacroAssembler* masm,
784 Register receiver, 780 Register receiver,
785 Register holder, 781 Register holder,
786 Register name, 782 Register name,
787 Handle<JSObject> holder_obj) { 783 Handle<JSObject> holder_obj) {
784 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0);
785 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1);
786 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2);
787 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3);
788 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4);
788 __ push(name); 789 __ push(name);
789 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); 790 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor());
790 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); 791 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor));
791 Register scratch = name; 792 Register scratch = name;
792 __ mov(scratch, Operand(interceptor)); 793 __ mov(scratch, Operand(interceptor));
793 __ push(scratch); 794 __ push(scratch);
794 __ push(receiver); 795 __ push(receiver);
795 __ push(holder); 796 __ push(holder);
796 __ ldr(scratch, FieldMemOperand(scratch, InterceptorInfo::kDataOffset));
797 __ push(scratch);
798 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
799 __ push(scratch);
800 } 797 }
801 798
802 799
803 static void CompileCallLoadPropertyWithInterceptor( 800 static void CompileCallLoadPropertyWithInterceptor(
804 MacroAssembler* masm, 801 MacroAssembler* masm,
805 Register receiver, 802 Register receiver,
806 Register holder, 803 Register holder,
807 Register name, 804 Register name,
808 Handle<JSObject> holder_obj) { 805 Handle<JSObject> holder_obj) {
809 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 806 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
810 807
811 ExternalReference ref = 808 ExternalReference ref =
812 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), 809 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly),
813 masm->isolate()); 810 masm->isolate());
814 __ mov(r0, Operand(6)); 811 __ mov(r0, Operand(StubCache::kInterceptorArgsLength));
815 __ mov(r1, Operand(ref)); 812 __ mov(r1, Operand(ref));
816 813
817 CEntryStub stub(1); 814 CEntryStub stub(1);
818 __ CallStub(&stub); 815 __ CallStub(&stub);
819 } 816 }
820 817
821 818
822 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; 819 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength;
823 820
824 // Reserves space for the extra arguments to API function in the 821 // Reserves space for the extra arguments to API function in the
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 name, miss_label); 1100 name, miss_label);
1104 1101
1105 // Call a runtime function to load the interceptor property. 1102 // Call a runtime function to load the interceptor property.
1106 FrameScope scope(masm, StackFrame::INTERNAL); 1103 FrameScope scope(masm, StackFrame::INTERNAL);
1107 // Save the name_ register across the call. 1104 // Save the name_ register across the call.
1108 __ push(name_); 1105 __ push(name_);
1109 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); 1106 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder);
1110 __ CallExternalReference( 1107 __ CallExternalReference(
1111 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), 1108 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall),
1112 masm->isolate()), 1109 masm->isolate()),
1113 6); 1110 StubCache::kInterceptorArgsLength);
1114 // Restore the name_ register. 1111 // Restore the name_ register.
1115 __ pop(name_); 1112 __ pop(name_);
1116 // Leave the internal frame. 1113 // Leave the internal frame.
1117 } 1114 }
1118 1115
1119 void LoadWithInterceptor(MacroAssembler* masm, 1116 void LoadWithInterceptor(MacroAssembler* masm,
1120 Register receiver, 1117 Register receiver,
1121 Register holder, 1118 Register holder,
1122 Handle<JSObject> holder_obj, 1119 Handle<JSObject> holder_obj,
1123 Register scratch, 1120 Register scratch,
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 GenerateFastApiCall( 1410 GenerateFastApiCall(
1414 masm(), call_optimization, receiver(), scratch3(), 0, NULL); 1411 masm(), call_optimization, receiver(), scratch3(), 0, NULL);
1415 } 1412 }
1416 1413
1417 1414
1418 void BaseLoadStubCompiler::GenerateLoadCallback( 1415 void BaseLoadStubCompiler::GenerateLoadCallback(
1419 Register reg, 1416 Register reg,
1420 Handle<ExecutableAccessorInfo> callback) { 1417 Handle<ExecutableAccessorInfo> callback) {
1421 // Build AccessorInfo::args_ list on the stack and push property name below 1418 // Build AccessorInfo::args_ list on the stack and push property name below
1422 // the exit frame to make GC aware of them and store pointers to them. 1419 // the exit frame to make GC aware of them and store pointers to them.
1420 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 0);
1421 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == -1);
1422 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == -2);
1423 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == -3);
1424 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == -4);
1425 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == -5);
1426 ASSERT(!scratch2().is(reg));
1427 ASSERT(!scratch3().is(reg));
1428 ASSERT(!scratch4().is(reg));
1423 __ push(receiver()); 1429 __ push(receiver());
1424 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ 1430 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_
1425 if (heap()->InNewSpace(callback->data())) { 1431 if (heap()->InNewSpace(callback->data())) {
1426 __ Move(scratch3(), callback); 1432 __ Move(scratch3(), callback);
1427 __ ldr(scratch3(), FieldMemOperand(scratch3(), 1433 __ ldr(scratch3(), FieldMemOperand(scratch3(),
1428 ExecutableAccessorInfo::kDataOffset)); 1434 ExecutableAccessorInfo::kDataOffset));
1429 } else { 1435 } else {
1430 __ Move(scratch3(), Handle<Object>(callback->data(), isolate())); 1436 __ Move(scratch3(), Handle<Object>(callback->data(), isolate()));
1431 } 1437 }
1432 __ Push(reg, scratch3()); 1438 __ push(scratch3());
1433 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); 1439 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex);
1434 __ mov(scratch4(), scratch3()); 1440 __ mov(scratch4(), scratch3());
1435 __ Push(scratch3(), scratch4()); 1441 __ Push(scratch3(), scratch4());
1436 __ mov(scratch4(), 1442 __ mov(scratch4(),
1437 Operand(ExternalReference::isolate_address(isolate()))); 1443 Operand(ExternalReference::isolate_address(isolate())));
1438 __ Push(scratch4(), name()); 1444 __ Push(scratch4(), reg, name());
1439 __ mov(r0, sp); // r0 = Handle<Name> 1445 __ mov(r0, sp); // r0 = Handle<Name>
1440 1446
1441 const int kApiStackSpace = 1; 1447 const int kApiStackSpace = 1;
1442 FrameScope frame_scope(masm(), StackFrame::MANUAL); 1448 FrameScope frame_scope(masm(), StackFrame::MANUAL);
1443 __ EnterExitFrame(false, kApiStackSpace); 1449 __ EnterExitFrame(false, kApiStackSpace);
1444 1450
1445 // Create AccessorInfo instance on the stack above the exit frame with 1451 // Create AccessorInfo instance on the stack above the exit frame with
1446 // scratch2 (internal::Object** args_) as the data. 1452 // scratch2 (internal::Object** args_) as the data.
1447 __ str(scratch2(), MemOperand(sp, 1 * kPointerSize)); 1453 __ str(scratch2(), MemOperand(sp, 1 * kPointerSize));
1448 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& 1454 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo&
1449 1455
1450 const int kStackUnwindSpace = kFastApiCallArguments + 1; 1456 const int kStackUnwindSpace = kFastApiCallArguments + 1;
1451 Address getter_address = v8::ToCData<Address>(callback->getter()); 1457 Address getter_address = v8::ToCData<Address>(callback->getter());
1452 1458
1453 ApiFunction fun(getter_address); 1459 ApiFunction fun(getter_address);
1454 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; 1460 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
1455 ExternalReference ref = ExternalReference(&fun, type, isolate()); 1461 ExternalReference ref = ExternalReference(&fun, type, isolate());
1456 1462
1457 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); 1463 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1458 ExternalReference::Type thunk_type = 1464 ExternalReference::Type thunk_type =
1459 ExternalReference::PROFILING_GETTER_CALL; 1465 ExternalReference::PROFILING_GETTER_CALL;
1460 ApiFunction thunk_fun(thunk_address); 1466 ApiFunction thunk_fun(thunk_address);
1461 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, 1467 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
1462 isolate()); 1468 isolate());
1463 __ CallApiFunctionAndReturn(ref, 1469 __ CallApiFunctionAndReturn(ref,
1464 getter_address, 1470 getter_address,
1465 thunk_ref, 1471 thunk_ref,
1466 r2, 1472 r2,
1467 kStackUnwindSpace, 1473 kStackUnwindSpace,
1468 5); 1474 6);
1469 } 1475 }
1470 1476
1471 1477
1472 void BaseLoadStubCompiler::GenerateLoadInterceptor( 1478 void BaseLoadStubCompiler::GenerateLoadInterceptor(
1473 Register holder_reg, 1479 Register holder_reg,
1474 Handle<JSObject> object, 1480 Handle<JSObject> object,
1475 Handle<JSObject> interceptor_holder, 1481 Handle<JSObject> interceptor_holder,
1476 LookupResult* lookup, 1482 LookupResult* lookup,
1477 Handle<Name> name) { 1483 Handle<Name> name) {
1478 ASSERT(interceptor_holder->HasNamedInterceptor()); 1484 ASSERT(interceptor_holder->HasNamedInterceptor());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup); 1552 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup);
1547 } else { // !compile_followup_inline 1553 } else { // !compile_followup_inline
1548 // Call the runtime system to load the interceptor. 1554 // Call the runtime system to load the interceptor.
1549 // Check that the maps haven't changed. 1555 // Check that the maps haven't changed.
1550 PushInterceptorArguments(masm(), receiver(), holder_reg, 1556 PushInterceptorArguments(masm(), receiver(), holder_reg,
1551 this->name(), interceptor_holder); 1557 this->name(), interceptor_holder);
1552 1558
1553 ExternalReference ref = 1559 ExternalReference ref =
1554 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), 1560 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad),
1555 isolate()); 1561 isolate());
1556 __ TailCallExternalReference(ref, 6, 1); 1562 __ TailCallExternalReference(ref, StubCache::kInterceptorArgsLength, 1);
1557 } 1563 }
1558 } 1564 }
1559 1565
1560 1566
1561 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { 1567 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) {
1562 if (kind_ == Code::KEYED_CALL_IC) { 1568 if (kind_ == Code::KEYED_CALL_IC) {
1563 __ cmp(r2, Operand(name)); 1569 __ cmp(r2, Operand(name));
1564 __ b(ne, miss); 1570 __ b(ne, miss);
1565 } 1571 }
1566 } 1572 }
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 // ----------------------------------- 3171 // -----------------------------------
3166 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3172 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3167 } 3173 }
3168 3174
3169 3175
3170 #undef __ 3176 #undef __
3171 3177
3172 } } // namespace v8::internal 3178 } } // namespace v8::internal
3173 3179
3174 #endif // V8_TARGET_ARCH_ARM 3180 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698