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

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

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase master Created 4 years, 6 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/s390/handler-compiler-s390.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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/ic/handler-compiler.h" 7 #include "src/ic/handler-compiler.h"
8 8
9 #include "src/api-arguments.h" 9 #include "src/api-arguments.h"
10 #include "src/field-type.h" 10 #include "src/field-type.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 break; 173 break;
174 case CallOptimization::kHolderNotFound: 174 case CallOptimization::kHolderNotFound:
175 UNREACHABLE(); 175 UNREACHABLE();
176 break; 176 break;
177 } 177 }
178 178
179 Isolate* isolate = masm->isolate(); 179 Isolate* isolate = masm->isolate();
180 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 180 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
181 bool call_data_undefined = false; 181 bool call_data_undefined = false;
182 // Put call data in place. 182 // Put call data in place.
183 if (api_call_info->data()->IsUndefined()) { 183 if (api_call_info->data()->IsUndefined(isolate)) {
184 call_data_undefined = true; 184 call_data_undefined = true;
185 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); 185 __ LoadRoot(data, Heap::kUndefinedValueRootIndex);
186 } else { 186 } else {
187 if (optimization.is_constant_call()) { 187 if (optimization.is_constant_call()) {
188 __ movp(data, 188 __ movp(data,
189 FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset)); 189 FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
190 __ movp(data, 190 __ movp(data,
191 FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset)); 191 FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
192 __ movp(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset)); 192 __ movp(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
193 } else { 193 } else {
(...skipping 19 matching lines...) Expand all
213 CallApiCallbackStub stub(isolate, is_store, call_data_undefined, 213 CallApiCallbackStub stub(isolate, is_store, call_data_undefined,
214 !optimization.is_constant_call()); 214 !optimization.is_constant_call());
215 __ TailCallStub(&stub); 215 __ TailCallStub(&stub);
216 } 216 }
217 217
218 218
219 void PropertyHandlerCompiler::GenerateCheckPropertyCell( 219 void PropertyHandlerCompiler::GenerateCheckPropertyCell(
220 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, 220 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name,
221 Register scratch, Label* miss) { 221 Register scratch, Label* miss) {
222 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); 222 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
223 DCHECK(cell->value()->IsTheHole()); 223 Isolate* isolate = masm->isolate();
224 Factory* factory = masm->isolate()->factory(); 224 DCHECK(cell->value()->IsTheHole(isolate));
225 Handle<WeakCell> weak_cell = factory->NewWeakCell(cell); 225 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(cell);
226 __ LoadWeakValue(scratch, weak_cell, miss); 226 __ LoadWeakValue(scratch, weak_cell, miss);
227 __ Cmp(FieldOperand(scratch, PropertyCell::kValueOffset), 227 __ Cmp(FieldOperand(scratch, PropertyCell::kValueOffset),
228 factory->the_hole_value()); 228 isolate->factory()->the_hole_value());
229 __ j(not_equal, miss); 229 __ j(not_equal, miss);
230 } 230 }
231 231
232 232
233 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( 233 void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
234 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder, 234 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder,
235 int accessor_index, int expected_arguments, Register scratch) { 235 int accessor_index, int expected_arguments, Register scratch) {
236 // ----------- S t a t e ------------- 236 // ----------- S t a t e -------------
237 // -- rsp[0] : return address 237 // -- rsp[0] : return address
238 // ----------------------------------- 238 // -----------------------------------
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { 568 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
569 // Return the constant value. 569 // Return the constant value.
570 __ Move(rax, value); 570 __ Move(rax, value);
571 __ ret(0); 571 __ ret(0);
572 } 572 }
573 573
574 574
575 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( 575 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
576 LookupIterator* it, Register holder_reg) { 576 LookupIterator* it, Register holder_reg) {
577 DCHECK(holder()->HasNamedInterceptor()); 577 DCHECK(holder()->HasNamedInterceptor());
578 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); 578 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate()));
579 579
580 // Compile the interceptor call, followed by inline code to load the 580 // Compile the interceptor call, followed by inline code to load the
581 // property from further up the prototype chain if the call fails. 581 // property from further up the prototype chain if the call fails.
582 // Check that the maps haven't changed. 582 // Check that the maps haven't changed.
583 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); 583 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1()));
584 584
585 // Preserve the receiver register explicitly whenever it is different from the 585 // Preserve the receiver register explicitly whenever it is different from the
586 // holder and it is needed should the interceptor return without any result. 586 // holder and it is needed should the interceptor return without any result.
587 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD 587 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD
588 // case might cause a miss during the prototype check. 588 // case might cause a miss during the prototype check.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 // Leave the internal frame. 630 // Leave the internal frame.
631 } 631 }
632 632
633 GenerateLoadPostInterceptor(it, holder_reg); 633 GenerateLoadPostInterceptor(it, holder_reg);
634 } 634 }
635 635
636 636
637 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { 637 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
638 // Call the runtime system to load the interceptor. 638 // Call the runtime system to load the interceptor.
639 DCHECK(holder()->HasNamedInterceptor()); 639 DCHECK(holder()->HasNamedInterceptor());
640 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); 640 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate()));
641 __ PopReturnAddressTo(scratch2()); 641 __ PopReturnAddressTo(scratch2());
642 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), 642 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
643 holder()); 643 holder());
644 __ PushReturnAddressFrom(scratch2()); 644 __ PushReturnAddressFrom(scratch2());
645 645
646 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); 646 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor);
647 } 647 }
648 648
649 649
650 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 650 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
651 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, 651 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback,
652 LanguageMode language_mode) { 652 LanguageMode language_mode) {
653 Register holder_reg = Frontend(name); 653 Register holder_reg = Frontend(name);
654 654
655 __ PopReturnAddressTo(scratch1()); 655 __ PopReturnAddressTo(scratch1());
656 __ Push(receiver()); 656 __ Push(receiver());
657 __ Push(holder_reg); 657 __ Push(holder_reg);
658 // If the callback cannot leak, then push the callback directly, 658 // If the callback cannot leak, then push the callback directly,
659 // otherwise wrap it in a weak cell. 659 // otherwise wrap it in a weak cell.
660 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { 660 if (callback->data()->IsUndefined(isolate()) || callback->data()->IsSmi()) {
661 __ Push(callback); 661 __ Push(callback);
662 } else { 662 } else {
663 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); 663 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
664 __ Push(cell); 664 __ Push(cell);
665 } 665 }
666 __ Push(name); 666 __ Push(name);
667 __ Push(value()); 667 __ Push(value());
668 __ Push(Smi::FromInt(language_mode)); 668 __ Push(Smi::FromInt(language_mode));
669 __ PushReturnAddressFrom(scratch1()); 669 __ PushReturnAddressFrom(scratch1());
670 670
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 // Return the generated code. 716 // Return the generated code.
717 return GetCode(kind(), name); 717 return GetCode(kind(), name);
718 } 718 }
719 719
720 720
721 #undef __ 721 #undef __
722 } // namespace internal 722 } // namespace internal
723 } // namespace v8 723 } // namespace v8
724 724
725 #endif // V8_TARGET_ARCH_X64 725 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/s390/handler-compiler-s390.cc ('k') | src/ic/x87/handler-compiler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698