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

Side by Side Diff: src/ic/x64/handler-compiler-x64.cc

Issue 877243004: Load callback data from weak cell instead of embedding it in handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/ic/mips64/handler-compiler-mips64.cc ('k') | src/ic/x87/handler-compiler-x87.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/ic/call-optimization.h" 9 #include "src/ic/call-optimization.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 __ PopReturnAddressTo(scratch4()); 555 __ PopReturnAddressTo(scratch4());
556 556
557 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); 557 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0);
558 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); 558 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1);
559 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); 559 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2);
560 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); 560 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3);
561 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); 561 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4);
562 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); 562 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
563 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); 563 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
564 __ Push(receiver()); // receiver 564 __ Push(receiver()); // receiver
565 if (heap()->InNewSpace(callback->data())) { 565 Handle<Object> data(callback->data(), isolate());
566 if (data->IsUndefined() || data->IsSmi()) {
567 __ Push(data);
568 } else {
566 DCHECK(!scratch2().is(reg)); 569 DCHECK(!scratch2().is(reg));
567 __ Move(scratch2(), callback); 570 Handle<WeakCell> cell =
568 __ Push(FieldOperand(scratch2(), 571 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
569 ExecutableAccessorInfo::kDataOffset)); // data 572 // The callback is alive if this instruction is executed,
570 } else { 573 // so the weak cell is not cleared and points to data.
571 __ Push(Handle<Object>(callback->data(), isolate())); 574 __ GetWeakValue(scratch2(), cell);
575 __ Push(scratch2());
572 } 576 }
573 DCHECK(!kScratchRegister.is(reg)); 577 DCHECK(!kScratchRegister.is(reg));
574 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); 578 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
575 __ Push(kScratchRegister); // return value 579 __ Push(kScratchRegister); // return value
576 __ Push(kScratchRegister); // return value default 580 __ Push(kScratchRegister); // return value default
577 __ PushAddress(ExternalReference::isolate_address(isolate())); 581 __ PushAddress(ExternalReference::isolate_address(isolate()));
578 __ Push(reg); // holder 582 __ Push(reg); // holder
579 __ Push(name()); // name 583 __ Push(name()); // name
580 // Save a pointer to where we pushed the arguments pointer. This will be 584 // Save a pointer to where we pushed the arguments pointer. This will be
581 // passed as the const PropertyAccessorInfo& to the C++ callback. 585 // passed as the const PropertyAccessorInfo& to the C++ callback.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // Return the generated code. 762 // Return the generated code.
759 return GetCode(kind(), Code::NORMAL, name); 763 return GetCode(kind(), Code::NORMAL, name);
760 } 764 }
761 765
762 766
763 #undef __ 767 #undef __
764 } 768 }
765 } // namespace v8::internal 769 } // namespace v8::internal
766 770
767 #endif // V8_TARGET_ARCH_X64 771 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/mips64/handler-compiler-mips64.cc ('k') | src/ic/x87/handler-compiler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698