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

Side by Side Diff: src/x64/stub-cache-x64.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/x64/macro-assembler-x64.cc ('k') | test/cctest/cctest.gyp » ('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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #if V8_TARGET_ARCH_X64 30 #if V8_TARGET_ARCH_X64
31 31
32 #include "arguments.h"
32 #include "ic-inl.h" 33 #include "ic-inl.h"
33 #include "codegen.h" 34 #include "codegen.h"
34 #include "stub-cache.h" 35 #include "stub-cache.h"
35 36
36 namespace v8 { 37 namespace v8 {
37 namespace internal { 38 namespace internal {
38 39
39 #define __ ACCESS_MASM(masm) 40 #define __ ACCESS_MASM(masm)
40 41
41 42
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 STATIC_ASSERT(kNotStringTag != 0); 297 STATIC_ASSERT(kNotStringTag != 0);
297 __ testl(scratch, Immediate(kNotStringTag)); 298 __ testl(scratch, Immediate(kNotStringTag));
298 __ j(not_zero, non_string_object); 299 __ j(not_zero, non_string_object);
299 } 300 }
300 301
301 302
302 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, 303 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm,
303 Register receiver, 304 Register receiver,
304 Register scratch1, 305 Register scratch1,
305 Register scratch2, 306 Register scratch2,
306 Label* miss, 307 Label* miss) {
307 bool support_wrappers) {
308 Label check_wrapper; 308 Label check_wrapper;
309 309
310 // Check if the object is a string leaving the instance type in the 310 // Check if the object is a string leaving the instance type in the
311 // scratch register. 311 // scratch register.
312 GenerateStringCheck(masm, receiver, scratch1, miss, 312 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper);
313 support_wrappers ? &check_wrapper : miss);
314 313
315 // Load length directly from the string. 314 // Load length directly from the string.
316 __ movq(rax, FieldOperand(receiver, String::kLengthOffset)); 315 __ movq(rax, FieldOperand(receiver, String::kLengthOffset));
317 __ ret(0); 316 __ ret(0);
318 317
319 if (support_wrappers) { 318 // Check if the object is a JSValue wrapper.
320 // Check if the object is a JSValue wrapper. 319 __ bind(&check_wrapper);
321 __ bind(&check_wrapper); 320 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE));
322 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE)); 321 __ j(not_equal, miss);
323 __ j(not_equal, miss);
324 322
325 // Check if the wrapped value is a string and load the length 323 // Check if the wrapped value is a string and load the length
326 // directly if it is. 324 // directly if it is.
327 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); 325 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset));
328 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); 326 GenerateStringCheck(masm, scratch2, scratch1, miss, miss);
329 __ movq(rax, FieldOperand(scratch2, String::kLengthOffset)); 327 __ movq(rax, FieldOperand(scratch2, String::kLengthOffset));
330 __ ret(0); 328 __ ret(0);
331 }
332 } 329 }
333 330
334 331
335 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, 332 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
336 Register receiver, 333 Register receiver,
337 Register result, 334 Register result,
338 Register scratch, 335 Register scratch,
339 Label* miss_label) { 336 Label* miss_label) {
340 __ TryGetFunctionPrototype(receiver, result, miss_label); 337 __ TryGetFunctionPrototype(receiver, result, miss_label);
341 if (!result.is(rax)) __ movq(rax, result); 338 if (!result.is(rax)) __ movq(rax, result);
(...skipping 17 matching lines...) Expand all
359 } 356 }
360 __ movq(dst, FieldOperand(src, offset)); 357 __ movq(dst, FieldOperand(src, offset));
361 } 358 }
362 359
363 360
364 static void PushInterceptorArguments(MacroAssembler* masm, 361 static void PushInterceptorArguments(MacroAssembler* masm,
365 Register receiver, 362 Register receiver,
366 Register holder, 363 Register holder,
367 Register name, 364 Register name,
368 Handle<JSObject> holder_obj) { 365 Handle<JSObject> holder_obj) {
366 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0);
367 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1);
368 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2);
369 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3);
370 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4);
369 __ push(name); 371 __ push(name);
370 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); 372 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor());
371 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); 373 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor));
372 __ Move(kScratchRegister, interceptor); 374 __ Move(kScratchRegister, interceptor);
373 __ push(kScratchRegister); 375 __ push(kScratchRegister);
374 __ push(receiver); 376 __ push(receiver);
375 __ push(holder); 377 __ push(holder);
376 __ push(FieldOperand(kScratchRegister, InterceptorInfo::kDataOffset));
377 __ PushAddress(ExternalReference::isolate_address(masm->isolate()));
378 } 378 }
379 379
380 380
381 static void CompileCallLoadPropertyWithInterceptor( 381 static void CompileCallLoadPropertyWithInterceptor(
382 MacroAssembler* masm, 382 MacroAssembler* masm,
383 Register receiver, 383 Register receiver,
384 Register holder, 384 Register holder,
385 Register name, 385 Register name,
386 Handle<JSObject> holder_obj) { 386 Handle<JSObject> holder_obj) {
387 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 387 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
388 388
389 ExternalReference ref = 389 ExternalReference ref =
390 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), 390 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly),
391 masm->isolate()); 391 masm->isolate());
392 __ Set(rax, 6); 392 __ Set(rax, StubCache::kInterceptorArgsLength);
393 __ LoadAddress(rbx, ref); 393 __ LoadAddress(rbx, ref);
394 394
395 CEntryStub stub(1); 395 CEntryStub stub(1);
396 __ CallStub(&stub); 396 __ CallStub(&stub);
397 } 397 }
398 398
399 399
400 // Number of pointers to be reserved on stack for fast API call. 400 // Number of pointers to be reserved on stack for fast API call.
401 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; 401 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength;
402 402
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 712
713 FrameScope scope(masm, StackFrame::INTERNAL); 713 FrameScope scope(masm, StackFrame::INTERNAL);
714 // Save the name_ register across the call. 714 // Save the name_ register across the call.
715 __ push(name_); 715 __ push(name_);
716 716
717 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); 717 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder);
718 718
719 __ CallExternalReference( 719 __ CallExternalReference(
720 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), 720 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall),
721 masm->isolate()), 721 masm->isolate()),
722 6); 722 StubCache::kInterceptorArgsLength);
723 723
724 // Restore the name_ register. 724 // Restore the name_ register.
725 __ pop(name_); 725 __ pop(name_);
726 726
727 // Leave the internal frame. 727 // Leave the internal frame.
728 } 728 }
729 729
730 void LoadWithInterceptor(MacroAssembler* masm, 730 void LoadWithInterceptor(MacroAssembler* masm,
731 Register receiver, 731 Register receiver,
732 Register holder, 732 Register holder,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } else if (FLAG_track_fields && representation.IsSmi()) { 831 } else if (FLAG_track_fields && representation.IsSmi()) {
832 __ JumpIfNotSmi(value_reg, miss_label); 832 __ JumpIfNotSmi(value_reg, miss_label);
833 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 833 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
834 __ JumpIfSmi(value_reg, miss_label); 834 __ JumpIfSmi(value_reg, miss_label);
835 } else if (FLAG_track_double_fields && representation.IsDouble()) { 835 } else if (FLAG_track_double_fields && representation.IsDouble()) {
836 Label do_store, heap_number; 836 Label do_store, heap_number;
837 __ AllocateHeapNumber(storage_reg, scratch1, slow); 837 __ AllocateHeapNumber(storage_reg, scratch1, slow);
838 838
839 __ JumpIfNotSmi(value_reg, &heap_number); 839 __ JumpIfNotSmi(value_reg, &heap_number);
840 __ SmiToInteger32(scratch1, value_reg); 840 __ SmiToInteger32(scratch1, value_reg);
841 __ cvtlsi2sd(xmm0, scratch1); 841 __ Cvtlsi2sd(xmm0, scratch1);
842 __ jmp(&do_store); 842 __ jmp(&do_store);
843 843
844 __ bind(&heap_number); 844 __ bind(&heap_number);
845 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), 845 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(),
846 miss_label, DONT_DO_SMI_CHECK); 846 miss_label, DONT_DO_SMI_CHECK);
847 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); 847 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset));
848 848
849 __ bind(&do_store); 849 __ bind(&do_store);
850 __ movsd(FieldOperand(storage_reg, HeapNumber::kValueOffset), xmm0); 850 __ movsd(FieldOperand(storage_reg, HeapNumber::kValueOffset), xmm0);
851 } 851 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 __ movq(scratch1, 985 __ movq(scratch1,
986 FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); 986 FieldOperand(receiver_reg, JSObject::kPropertiesOffset));
987 int offset = index * kPointerSize + FixedArray::kHeaderSize; 987 int offset = index * kPointerSize + FixedArray::kHeaderSize;
988 __ movq(scratch1, FieldOperand(scratch1, offset)); 988 __ movq(scratch1, FieldOperand(scratch1, offset));
989 } 989 }
990 990
991 // Store the value into the storage. 991 // Store the value into the storage.
992 Label do_store, heap_number; 992 Label do_store, heap_number;
993 __ JumpIfNotSmi(value_reg, &heap_number); 993 __ JumpIfNotSmi(value_reg, &heap_number);
994 __ SmiToInteger32(scratch2, value_reg); 994 __ SmiToInteger32(scratch2, value_reg);
995 __ cvtlsi2sd(xmm0, scratch2); 995 __ Cvtlsi2sd(xmm0, scratch2);
996 __ jmp(&do_store); 996 __ jmp(&do_store);
997 997
998 __ bind(&heap_number); 998 __ bind(&heap_number);
999 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), 999 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(),
1000 miss_label, DONT_DO_SMI_CHECK); 1000 miss_label, DONT_DO_SMI_CHECK);
1001 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); 1001 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset));
1002 __ bind(&do_store); 1002 __ bind(&do_store);
1003 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0); 1003 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0);
1004 // Return the value (register rax). 1004 // Return the value (register rax).
1005 ASSERT(value_reg.is(rax)); 1005 ASSERT(value_reg.is(rax));
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 } 1315 }
1316 1316
1317 1317
1318 void BaseLoadStubCompiler::GenerateLoadCallback( 1318 void BaseLoadStubCompiler::GenerateLoadCallback(
1319 Register reg, 1319 Register reg,
1320 Handle<ExecutableAccessorInfo> callback) { 1320 Handle<ExecutableAccessorInfo> callback) {
1321 // Insert additional parameters into the stack frame above return address. 1321 // Insert additional parameters into the stack frame above return address.
1322 ASSERT(!scratch4().is(reg)); 1322 ASSERT(!scratch4().is(reg));
1323 __ PopReturnAddressTo(scratch4()); 1323 __ PopReturnAddressTo(scratch4());
1324 1324
1325 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 0);
1326 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == -1);
1327 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == -2);
1328 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == -3);
1329 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == -4);
1330 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == -5);
1325 __ push(receiver()); // receiver 1331 __ push(receiver()); // receiver
1326 __ push(reg); // holder
1327 if (heap()->InNewSpace(callback->data())) { 1332 if (heap()->InNewSpace(callback->data())) {
1328 __ Move(scratch1(), callback); 1333 ASSERT(!scratch2().is(reg));
1329 __ push(FieldOperand(scratch1(), 1334 __ Move(scratch2(), callback);
1335 __ push(FieldOperand(scratch2(),
1330 ExecutableAccessorInfo::kDataOffset)); // data 1336 ExecutableAccessorInfo::kDataOffset)); // data
1331 } else { 1337 } else {
1332 __ Push(Handle<Object>(callback->data(), isolate())); 1338 __ Push(Handle<Object>(callback->data(), isolate()));
1333 } 1339 }
1340 ASSERT(!kScratchRegister.is(reg));
1334 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); 1341 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
1335 __ push(kScratchRegister); // return value 1342 __ push(kScratchRegister); // return value
1336 __ push(kScratchRegister); // return value default 1343 __ push(kScratchRegister); // return value default
1337 __ PushAddress(ExternalReference::isolate_address(isolate())); 1344 __ PushAddress(ExternalReference::isolate_address(isolate()));
1345 __ push(reg); // holder
1338 __ push(name()); // name 1346 __ push(name()); // name
1339 // Save a pointer to where we pushed the arguments pointer. This will be 1347 // Save a pointer to where we pushed the arguments pointer. This will be
1340 // passed as the const ExecutableAccessorInfo& to the C++ callback. 1348 // passed as the const ExecutableAccessorInfo& to the C++ callback.
1341 1349
1342 Address getter_address = v8::ToCData<Address>(callback->getter()); 1350 Address getter_address = v8::ToCData<Address>(callback->getter());
1343 1351
1344 #if defined(__MINGW64__) || defined(_WIN64) 1352 #if defined(__MINGW64__) || defined(_WIN64)
1345 Register getter_arg = r8; 1353 Register getter_arg = r8;
1346 Register accessor_info_arg = rdx; 1354 Register accessor_info_arg = rdx;
1347 Register name_arg = rcx; 1355 Register name_arg = rcx;
(...skipping 23 matching lines...) Expand all
1371 // The context register (rsi) has been saved in PrepareCallApiFunction and 1379 // The context register (rsi) has been saved in PrepareCallApiFunction and
1372 // could be used to pass arguments. 1380 // could be used to pass arguments.
1373 __ lea(accessor_info_arg, StackSpaceOperand(0)); 1381 __ lea(accessor_info_arg, StackSpaceOperand(0));
1374 1382
1375 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); 1383 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1376 1384
1377 __ CallApiFunctionAndReturn(getter_address, 1385 __ CallApiFunctionAndReturn(getter_address,
1378 thunk_address, 1386 thunk_address,
1379 getter_arg, 1387 getter_arg,
1380 kStackSpace, 1388 kStackSpace,
1381 5); 1389 6);
1382 } 1390 }
1383 1391
1384 1392
1385 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 1393 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
1386 // Return the constant value. 1394 // Return the constant value.
1387 __ LoadObject(rax, value); 1395 __ LoadObject(rax, value);
1388 __ ret(0); 1396 __ ret(0);
1389 } 1397 }
1390 1398
1391 1399
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 } else { // !compile_followup_inline 1478 } else { // !compile_followup_inline
1471 // Call the runtime system to load the interceptor. 1479 // Call the runtime system to load the interceptor.
1472 // Check that the maps haven't changed. 1480 // Check that the maps haven't changed.
1473 __ PopReturnAddressTo(scratch2()); 1481 __ PopReturnAddressTo(scratch2());
1474 PushInterceptorArguments(masm(), receiver(), holder_reg, 1482 PushInterceptorArguments(masm(), receiver(), holder_reg,
1475 this->name(), interceptor_holder); 1483 this->name(), interceptor_holder);
1476 __ PushReturnAddressFrom(scratch2()); 1484 __ PushReturnAddressFrom(scratch2());
1477 1485
1478 ExternalReference ref = ExternalReference( 1486 ExternalReference ref = ExternalReference(
1479 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate()); 1487 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate());
1480 __ TailCallExternalReference(ref, 6, 1); 1488 __ TailCallExternalReference(ref, StubCache::kInterceptorArgsLength, 1);
1481 } 1489 }
1482 } 1490 }
1483 1491
1484 1492
1485 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { 1493 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) {
1486 if (kind_ == Code::KEYED_CALL_IC) { 1494 if (kind_ == Code::KEYED_CALL_IC) {
1487 __ Cmp(rcx, name); 1495 __ Cmp(rcx, name);
1488 __ j(not_equal, miss); 1496 __ j(not_equal, miss);
1489 } 1497 }
1490 } 1498 }
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
3150 // ----------------------------------- 3158 // -----------------------------------
3151 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3159 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3152 } 3160 }
3153 3161
3154 3162
3155 #undef __ 3163 #undef __
3156 3164
3157 } } // namespace v8::internal 3165 } } // namespace v8::internal
3158 3166
3159 #endif // V8_TARGET_ARCH_X64 3167 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698