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

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

Issue 157543002: A64: Synchronize with r18581. (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') | src/zone.cc » ('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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex), 468 __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex),
469 kScratchRegister); 469 kScratchRegister);
470 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); 470 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
471 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex), 471 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex),
472 kScratchRegister); 472 kScratchRegister);
473 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset), 473 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset),
474 kScratchRegister); 474 kScratchRegister);
475 475
476 // Prepare arguments. 476 // Prepare arguments.
477 STATIC_ASSERT(kFastApiCallArguments == 7); 477 STATIC_ASSERT(kFastApiCallArguments == 7);
478 __ lea(rax, Operand(rsp, 1 * kPointerSize)); 478 __ lea(rax, args.GetArgumentOperand(offset - FCA::kHolderIndex));
479 479
480 GenerateFastApiCallBody(masm, optimization, argc, false); 480 GenerateFastApiCallBody(masm, optimization, argc, false);
481 } 481 }
482 482
483 483
484 // Generate call to api function. 484 // Generate call to api function.
485 // This function uses push() to generate smaller, faster code than 485 // This function uses push() to generate smaller, faster code than
486 // the version above. It is an optimization that should will be removed 486 // the version above. It is an optimization that should will be removed
487 // when api call ICs are generated in hydrogen. 487 // when api call ICs are generated in hydrogen.
488 static void GenerateFastApiCall(MacroAssembler* masm, 488 static void GenerateFastApiCall(MacroAssembler* masm,
489 const CallOptimization& optimization, 489 const CallOptimization& optimization,
490 Register receiver, 490 Register receiver,
491 Register scratch1, 491 Register scratch1,
492 Register scratch2, 492 Register scratch2,
493 Register scratch3, 493 Register scratch3,
494 int argc, 494 int argc,
495 Register* values) { 495 Register* values) {
496 ASSERT(optimization.is_simple_api_call()); 496 ASSERT(optimization.is_simple_api_call());
497 497
498 // Copy return value. 498 __ PopReturnAddressTo(scratch1);
499 __ pop(scratch1);
500 499
501 // receiver 500 // receiver
502 __ push(receiver); 501 __ push(receiver);
503 502
504 // Write the arguments to stack frame. 503 // Write the arguments to stack frame.
505 for (int i = 0; i < argc; i++) { 504 for (int i = 0; i < argc; i++) {
506 Register arg = values[argc-1-i]; 505 Register arg = values[argc-1-i];
507 ASSERT(!receiver.is(arg)); 506 ASSERT(!receiver.is(arg));
508 ASSERT(!scratch1.is(arg)); 507 ASSERT(!scratch1.is(arg));
509 ASSERT(!scratch2.is(arg)); 508 ASSERT(!scratch2.is(arg));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // isolate 555 // isolate
557 __ Move(scratch3, 556 __ Move(scratch3,
558 ExternalReference::isolate_address(masm->isolate())); 557 ExternalReference::isolate_address(masm->isolate()));
559 __ push(scratch3); 558 __ push(scratch3);
560 // holder 559 // holder
561 __ push(receiver); 560 __ push(receiver);
562 561
563 ASSERT(!scratch1.is(rax)); 562 ASSERT(!scratch1.is(rax));
564 // store receiver address for GenerateFastApiCallBody 563 // store receiver address for GenerateFastApiCallBody
565 __ movq(rax, rsp); 564 __ movq(rax, rsp);
566 565 __ PushReturnAddressFrom(scratch1);
567 // return address
568 __ push(scratch1);
569 566
570 GenerateFastApiCallBody(masm, optimization, argc, true); 567 GenerateFastApiCallBody(masm, optimization, argc, true);
571 } 568 }
572 569
573 570
574 static void GenerateFastApiCallBody(MacroAssembler* masm, 571 static void GenerateFastApiCallBody(MacroAssembler* masm,
575 const CallOptimization& optimization, 572 const CallOptimization& optimization,
576 int argc, 573 int argc,
577 bool restore_context) { 574 bool restore_context) {
578 // ----------- S t a t e ------------- 575 // ----------- S t a t e -------------
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 // If probing finds an entry in the dictionary, scratch3 contains the 1297 // If probing finds an entry in the dictionary, scratch3 contains the
1301 // index into the dictionary. Check that the value is the callback. 1298 // index into the dictionary. Check that the value is the callback.
1302 Register index = scratch3(); 1299 Register index = scratch3();
1303 const int kElementsStartOffset = 1300 const int kElementsStartOffset =
1304 NameDictionary::kHeaderSize + 1301 NameDictionary::kHeaderSize +
1305 NameDictionary::kElementsStartIndex * kPointerSize; 1302 NameDictionary::kElementsStartIndex * kPointerSize;
1306 const int kValueOffset = kElementsStartOffset + kPointerSize; 1303 const int kValueOffset = kElementsStartOffset + kPointerSize;
1307 __ movq(scratch2(), 1304 __ movq(scratch2(),
1308 Operand(dictionary, index, times_pointer_size, 1305 Operand(dictionary, index, times_pointer_size,
1309 kValueOffset - kHeapObjectTag)); 1306 kValueOffset - kHeapObjectTag));
1310 __ movq(scratch3(), callback, RelocInfo::EMBEDDED_OBJECT); 1307 __ Move(scratch3(), callback, RelocInfo::EMBEDDED_OBJECT);
1311 __ cmpq(scratch2(), scratch3()); 1308 __ cmpq(scratch2(), scratch3());
1312 __ j(not_equal, &miss); 1309 __ j(not_equal, &miss);
1313 } 1310 }
1314 1311
1315 HandlerFrontendFooter(name, &miss); 1312 HandlerFrontendFooter(name, &miss);
1316 return reg; 1313 return reg;
1317 } 1314 }
1318 1315
1319 1316
1320 void LoadStubCompiler::GenerateLoadField(Register reg, 1317 void LoadStubCompiler::GenerateLoadField(Register reg,
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 Label success; 2368 Label success;
2372 // Check that the object is a boolean. 2369 // Check that the object is a boolean.
2373 __ CompareRoot(object, Heap::kTrueValueRootIndex); 2370 __ CompareRoot(object, Heap::kTrueValueRootIndex);
2374 __ j(equal, &success); 2371 __ j(equal, &success);
2375 __ CompareRoot(object, Heap::kFalseValueRootIndex); 2372 __ CompareRoot(object, Heap::kFalseValueRootIndex);
2376 __ j(not_equal, miss); 2373 __ j(not_equal, miss);
2377 __ bind(&success); 2374 __ bind(&success);
2378 } 2375 }
2379 2376
2380 2377
2381 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { 2378 void CallStubCompiler::PatchImplicitReceiver(Handle<Object> object) {
2382 if (object->IsGlobalObject()) { 2379 if (object->IsGlobalObject()) {
2383 StackArgumentsAccessor args(rsp, arguments()); 2380 StackArgumentsAccessor args(rsp, arguments());
2384 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); 2381 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
2385 __ movq(args.GetReceiverOperand(), rdx); 2382 __ movq(args.GetReceiverOperand(), rdx);
2386 } 2383 }
2387 } 2384 }
2388 2385
2389 2386
2390 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, 2387 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object,
2391 Handle<JSObject> holder, 2388 Handle<JSObject> holder,
2392 Handle<Name> name, 2389 Handle<Name> name,
2393 CheckType check, 2390 CheckType check,
2394 Label* miss) { 2391 Label* miss) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 } 2465 }
2469 2466
2470 2467
2471 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, 2468 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object,
2472 Register function, 2469 Register function,
2473 Label* miss) { 2470 Label* miss) {
2474 // Check that the function really is a function. 2471 // Check that the function really is a function.
2475 GenerateFunctionCheck(function, rbx, miss); 2472 GenerateFunctionCheck(function, rbx, miss);
2476 2473
2477 if (!function.is(rdi)) __ movq(rdi, function); 2474 if (!function.is(rdi)) __ movq(rdi, function);
2478 PatchGlobalProxy(object); 2475 PatchImplicitReceiver(object);
2479 2476
2480 // Invoke the function. 2477 // Invoke the function.
2481 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, 2478 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION,
2482 NullCallWrapper(), call_kind()); 2479 NullCallWrapper(), call_kind());
2483 } 2480 }
2484 2481
2485 2482
2486 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, 2483 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object,
2487 Handle<JSObject> holder, 2484 Handle<JSObject> holder,
2488 Handle<Name> name) { 2485 Handle<Name> name) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 __ movq(scratch1(), FieldOperand(receiver(), HeapObject::kMapOffset)); 2657 __ movq(scratch1(), FieldOperand(receiver(), HeapObject::kMapOffset));
2661 int receiver_count = receiver_maps->length(); 2658 int receiver_count = receiver_maps->length();
2662 for (int i = 0; i < receiver_count; ++i) { 2659 for (int i = 0; i < receiver_count; ++i) {
2663 // Check map and tail call if there's a match 2660 // Check map and tail call if there's a match
2664 __ Cmp(scratch1(), receiver_maps->at(i)); 2661 __ Cmp(scratch1(), receiver_maps->at(i));
2665 if (transitioned_maps->at(i).is_null()) { 2662 if (transitioned_maps->at(i).is_null()) {
2666 __ j(equal, handler_stubs->at(i), RelocInfo::CODE_TARGET); 2663 __ j(equal, handler_stubs->at(i), RelocInfo::CODE_TARGET);
2667 } else { 2664 } else {
2668 Label next_map; 2665 Label next_map;
2669 __ j(not_equal, &next_map, Label::kNear); 2666 __ j(not_equal, &next_map, Label::kNear);
2670 __ movq(transition_map(), 2667 __ Move(transition_map(),
2671 transitioned_maps->at(i), 2668 transitioned_maps->at(i),
2672 RelocInfo::EMBEDDED_OBJECT); 2669 RelocInfo::EMBEDDED_OBJECT);
2673 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET); 2670 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET);
2674 __ bind(&next_map); 2671 __ bind(&next_map);
2675 } 2672 }
2676 } 2673 }
2677 2674
2678 __ bind(&miss); 2675 __ bind(&miss);
2679 2676
2680 TailCallBuiltin(masm(), MissBuiltin(kind())); 2677 TailCallBuiltin(masm(), MissBuiltin(kind()));
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 // ----------------------------------- 2907 // -----------------------------------
2911 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2908 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2912 } 2909 }
2913 2910
2914 2911
2915 #undef __ 2912 #undef __
2916 2913
2917 } } // namespace v8::internal 2914 } } // namespace v8::internal
2918 2915
2919 #endif // V8_TARGET_ARCH_X64 2916 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | src/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698