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

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

Issue 416513002: MIPS: 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 | « no previous file | src/mips64/macro-assembler-mips64.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 // 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 <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 3828 matching lines...) Expand 10 before | Expand all | Expand 10 after
3839 3839
3840 // --------------------------------------------------------------------------- 3840 // ---------------------------------------------------------------------------
3841 // Support functions. 3841 // Support functions.
3842 3842
3843 3843
3844 void MacroAssembler::TryGetFunctionPrototype(Register function, 3844 void MacroAssembler::TryGetFunctionPrototype(Register function,
3845 Register result, 3845 Register result,
3846 Register scratch, 3846 Register scratch,
3847 Label* miss, 3847 Label* miss,
3848 bool miss_on_bound_function) { 3848 bool miss_on_bound_function) {
3849 // Check that the receiver isn't a smi. 3849 Label non_instance;
3850 JumpIfSmi(function, miss); 3850 if (miss_on_bound_function) {
3851 // Check that the receiver isn't a smi.
3852 JumpIfSmi(function, miss);
3851 3853
3852 // Check that the function really is a function. Load map into result reg. 3854 // Check that the function really is a function. Load map into result reg.
3853 GetObjectType(function, result, scratch); 3855 GetObjectType(function, result, scratch);
3854 Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE)); 3856 Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE));
3855 3857
3856 if (miss_on_bound_function) {
3857 lw(scratch, 3858 lw(scratch,
3858 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); 3859 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
3859 lw(scratch, 3860 lw(scratch,
3860 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); 3861 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
3861 And(scratch, scratch, 3862 And(scratch, scratch,
3862 Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction))); 3863 Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction)));
3863 Branch(miss, ne, scratch, Operand(zero_reg)); 3864 Branch(miss, ne, scratch, Operand(zero_reg));
3865
3866 // Make sure that the function has an instance prototype.
3867 lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
3868 And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype));
3869 Branch(&non_instance, ne, scratch, Operand(zero_reg));
3864 } 3870 }
3865 3871
3866 // Make sure that the function has an instance prototype.
3867 Label non_instance;
3868 lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
3869 And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype));
3870 Branch(&non_instance, ne, scratch, Operand(zero_reg));
3871
3872 // Get the prototype or initial map from the function. 3872 // Get the prototype or initial map from the function.
3873 lw(result, 3873 lw(result,
3874 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 3874 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
3875 3875
3876 // If the prototype or initial map is the hole, don't return it and 3876 // If the prototype or initial map is the hole, don't return it and
3877 // simply miss the cache instead. This will allow us to allocate a 3877 // simply miss the cache instead. This will allow us to allocate a
3878 // prototype object on-demand in the runtime system. 3878 // prototype object on-demand in the runtime system.
3879 LoadRoot(t8, Heap::kTheHoleValueRootIndex); 3879 LoadRoot(t8, Heap::kTheHoleValueRootIndex);
3880 Branch(miss, eq, result, Operand(t8)); 3880 Branch(miss, eq, result, Operand(t8));
3881 3881
3882 // If the function does not have an initial map, we're done. 3882 // If the function does not have an initial map, we're done.
3883 Label done; 3883 Label done;
3884 GetObjectType(result, scratch, scratch); 3884 GetObjectType(result, scratch, scratch);
3885 Branch(&done, ne, scratch, Operand(MAP_TYPE)); 3885 Branch(&done, ne, scratch, Operand(MAP_TYPE));
3886 3886
3887 // Get the prototype from the initial map. 3887 // Get the prototype from the initial map.
3888 lw(result, FieldMemOperand(result, Map::kPrototypeOffset)); 3888 lw(result, FieldMemOperand(result, Map::kPrototypeOffset));
3889 jmp(&done);
3890 3889
3891 // Non-instance prototype: Fetch prototype from constructor field 3890 if (miss_on_bound_function) {
3892 // in initial map. 3891 jmp(&done);
3893 bind(&non_instance); 3892
3894 lw(result, FieldMemOperand(result, Map::kConstructorOffset)); 3893 // Non-instance prototype: Fetch prototype from constructor field
3894 // in initial map.
3895 bind(&non_instance);
3896 lw(result, FieldMemOperand(result, Map::kConstructorOffset));
3897 }
3895 3898
3896 // All done. 3899 // All done.
3897 bind(&done); 3900 bind(&done);
3898 } 3901 }
3899 3902
3900 3903
3901 void MacroAssembler::GetObjectType(Register object, 3904 void MacroAssembler::GetObjectType(Register object,
3902 Register map, 3905 Register map,
3903 Register type_reg) { 3906 Register type_reg) {
3904 lw(map, FieldMemOperand(object, HeapObject::kMapOffset)); 3907 lw(map, FieldMemOperand(object, HeapObject::kMapOffset));
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
5751 } 5754 }
5752 if (ms.shift() > 0) sra(result, result, ms.shift()); 5755 if (ms.shift() > 0) sra(result, result, ms.shift());
5753 srl(at, dividend, 31); 5756 srl(at, dividend, 31);
5754 Addu(result, result, Operand(at)); 5757 Addu(result, result, Operand(at));
5755 } 5758 }
5756 5759
5757 5760
5758 } } // namespace v8::internal 5761 } } // namespace v8::internal
5759 5762
5760 #endif // V8_TARGET_ARCH_MIPS 5763 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/macro-assembler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698