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

Side by Side Diff: src/ic/ia32/handler-compiler-ia32.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/arm64/handler-compiler-arm64.cc ('k') | src/ic/mips/handler-compiler-mips.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_IA32 7 #if V8_TARGET_ARCH_IA32
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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 __ pop(scratch3()); // Get return address to place it below. 560 __ pop(scratch3()); // Get return address to place it below.
561 561
562 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); 562 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0);
563 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); 563 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1);
564 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); 564 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2);
565 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); 565 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3);
566 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); 566 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4);
567 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); 567 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
568 __ push(receiver()); // receiver 568 __ push(receiver()); // receiver
569 // Push data from ExecutableAccessorInfo. 569 // Push data from ExecutableAccessorInfo.
570 if (isolate()->heap()->InNewSpace(callback->data())) { 570 Handle<Object> data(callback->data(), isolate());
571 if (data->IsUndefined() || data->IsSmi()) {
572 __ push(Immediate(data));
573 } else {
571 DCHECK(!scratch2().is(reg)); 574 DCHECK(!scratch2().is(reg));
572 __ mov(scratch2(), Immediate(callback)); 575 Handle<WeakCell> cell =
573 __ push(FieldOperand(scratch2(), ExecutableAccessorInfo::kDataOffset)); 576 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
574 } else { 577 // The callback is alive if this instruction is executed,
575 __ push(Immediate(Handle<Object>(callback->data(), isolate()))); 578 // so the weak cell is not cleared and points to data.
579 __ GetWeakValue(scratch2(), cell);
580 __ push(scratch2());
576 } 581 }
577 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue 582 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue
578 // ReturnValue default value 583 // ReturnValue default value
579 __ push(Immediate(isolate()->factory()->undefined_value())); 584 __ push(Immediate(isolate()->factory()->undefined_value()));
580 __ push(Immediate(reinterpret_cast<int>(isolate()))); 585 __ push(Immediate(reinterpret_cast<int>(isolate())));
581 __ push(reg); // holder 586 __ push(reg); // holder
582 587
583 // Save a pointer to where we pushed the arguments. This will be 588 // Save a pointer to where we pushed the arguments. This will be
584 // passed as the const PropertyAccessorInfo& to the C++ callback. 589 // passed as the const PropertyAccessorInfo& to the C++ callback.
585 __ push(esp); 590 __ push(esp);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 // Return the generated code. 775 // Return the generated code.
771 return GetCode(kind(), Code::NORMAL, name); 776 return GetCode(kind(), Code::NORMAL, name);
772 } 777 }
773 778
774 779
775 #undef __ 780 #undef __
776 } 781 }
777 } // namespace v8::internal 782 } // namespace v8::internal
778 783
779 #endif // V8_TARGET_ARCH_IA32 784 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ic/arm64/handler-compiler-arm64.cc ('k') | src/ic/mips/handler-compiler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698