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

Side by Side Diff: src/arm64/macro-assembler-arm64.cc

Issue 412483003: Only to the relevant checks in LoadFunctionPrototype (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/arm/macro-assembler-arm.cc ('k') | src/ia32/macro-assembler-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3798 matching lines...) Expand 10 before | Expand all | Expand 10 after
3809 } 3809 }
3810 3810
3811 3811
3812 void MacroAssembler::TryGetFunctionPrototype(Register function, 3812 void MacroAssembler::TryGetFunctionPrototype(Register function,
3813 Register result, 3813 Register result,
3814 Register scratch, 3814 Register scratch,
3815 Label* miss, 3815 Label* miss,
3816 BoundFunctionAction action) { 3816 BoundFunctionAction action) {
3817 ASSERT(!AreAliased(function, result, scratch)); 3817 ASSERT(!AreAliased(function, result, scratch));
3818 3818
3819 // Check that the receiver isn't a smi. 3819 Label non_instance;
3820 JumpIfSmi(function, miss); 3820 if (action == kMissOnBoundFunction) {
3821 // Check that the receiver isn't a smi.
3822 JumpIfSmi(function, miss);
3821 3823
3822 // Check that the function really is a function. Load map into result reg. 3824 // Check that the function really is a function. Load map into result reg.
3823 JumpIfNotObjectType(function, result, scratch, JS_FUNCTION_TYPE, miss); 3825 JumpIfNotObjectType(function, result, scratch, JS_FUNCTION_TYPE, miss);
3824 3826
3825 if (action == kMissOnBoundFunction) {
3826 Register scratch_w = scratch.W(); 3827 Register scratch_w = scratch.W();
3827 Ldr(scratch, 3828 Ldr(scratch,
3828 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); 3829 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
3829 // On 64-bit platforms, compiler hints field is not a smi. See definition of 3830 // On 64-bit platforms, compiler hints field is not a smi. See definition of
3830 // kCompilerHintsOffset in src/objects.h. 3831 // kCompilerHintsOffset in src/objects.h.
3831 Ldr(scratch_w, 3832 Ldr(scratch_w,
3832 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); 3833 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
3833 Tbnz(scratch, SharedFunctionInfo::kBoundFunction, miss); 3834 Tbnz(scratch, SharedFunctionInfo::kBoundFunction, miss);
3835
3836 // Make sure that the function has an instance prototype.
3837 Ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
3838 Tbnz(scratch, Map::kHasNonInstancePrototype, &non_instance);
3834 } 3839 }
3835 3840
3836 // Make sure that the function has an instance prototype.
3837 Label non_instance;
3838 Ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
3839 Tbnz(scratch, Map::kHasNonInstancePrototype, &non_instance);
3840
3841 // Get the prototype or initial map from the function. 3841 // Get the prototype or initial map from the function.
3842 Ldr(result, 3842 Ldr(result,
3843 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 3843 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
3844 3844
3845 // If the prototype or initial map is the hole, don't return it and simply 3845 // If the prototype or initial map is the hole, don't return it and simply
3846 // miss the cache instead. This will allow us to allocate a prototype object 3846 // miss the cache instead. This will allow us to allocate a prototype object
3847 // on-demand in the runtime system. 3847 // on-demand in the runtime system.
3848 JumpIfRoot(result, Heap::kTheHoleValueRootIndex, miss); 3848 JumpIfRoot(result, Heap::kTheHoleValueRootIndex, miss);
3849 3849
3850 // If the function does not have an initial map, we're done. 3850 // If the function does not have an initial map, we're done.
3851 Label done; 3851 Label done;
3852 JumpIfNotObjectType(result, scratch, scratch, MAP_TYPE, &done); 3852 JumpIfNotObjectType(result, scratch, scratch, MAP_TYPE, &done);
3853 3853
3854 // Get the prototype from the initial map. 3854 // Get the prototype from the initial map.
3855 Ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); 3855 Ldr(result, FieldMemOperand(result, Map::kPrototypeOffset));
3856 B(&done);
3857 3856
3858 // Non-instance prototype: fetch prototype from constructor field in initial 3857 if (action == kMissOnBoundFunction) {
3859 // map. 3858 B(&done);
3860 Bind(&non_instance); 3859
3861 Ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); 3860 // Non-instance prototype: fetch prototype from constructor field in initial
3861 // map.
3862 Bind(&non_instance);
3863 Ldr(result, FieldMemOperand(result, Map::kConstructorOffset));
3864 }
3862 3865
3863 // All done. 3866 // All done.
3864 Bind(&done); 3867 Bind(&done);
3865 } 3868 }
3866 3869
3867 3870
3868 void MacroAssembler::CompareRoot(const Register& obj, 3871 void MacroAssembler::CompareRoot(const Register& obj,
3869 Heap::RootListIndex index) { 3872 Heap::RootListIndex index) {
3870 UseScratchRegisterScope temps(this); 3873 UseScratchRegisterScope temps(this);
3871 Register temp = temps.AcquireX(); 3874 Register temp = temps.AcquireX();
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
5370 } 5373 }
5371 } 5374 }
5372 5375
5373 5376
5374 #undef __ 5377 #undef __
5375 5378
5376 5379
5377 } } // namespace v8::internal 5380 } } // namespace v8::internal
5378 5381
5379 #endif // V8_TARGET_ARCH_ARM64 5382 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698