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

Side by Side Diff: src/mips/stub-cache-mips.cc

Issue 8428004: MIPS: Cleanup: use JumpIf[Not]Smi() whenever we can (Closed)
Patch Set: Fixed typo, rebased to r9884 Created 9 years, 1 month 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/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 __ lw(dst, FieldMemOperand(dst, offset)); 275 __ lw(dst, FieldMemOperand(dst, offset));
276 } 276 }
277 } 277 }
278 278
279 279
280 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm, 280 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
281 Register receiver, 281 Register receiver,
282 Register scratch, 282 Register scratch,
283 Label* miss_label) { 283 Label* miss_label) {
284 // Check that the receiver isn't a smi. 284 // Check that the receiver isn't a smi.
285 __ And(scratch, receiver, Operand(kSmiTagMask)); 285 __ JumpIfSmi(receiver, miss_label);
286 __ Branch(miss_label, eq, scratch, Operand(zero_reg));
287 286
288 // Check that the object is a JS array. 287 // Check that the object is a JS array.
289 __ GetObjectType(receiver, scratch, scratch); 288 __ GetObjectType(receiver, scratch, scratch);
290 __ Branch(miss_label, ne, scratch, Operand(JS_ARRAY_TYPE)); 289 __ Branch(miss_label, ne, scratch, Operand(JS_ARRAY_TYPE));
291 290
292 // Load length directly from the JS array. 291 // Load length directly from the JS array.
293 __ lw(v0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 292 __ lw(v0, FieldMemOperand(receiver, JSArray::kLengthOffset));
294 __ Ret(); 293 __ Ret();
295 } 294 }
296 295
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 void StubCompiler::GenerateLoadField(Handle<JSObject> object, 1092 void StubCompiler::GenerateLoadField(Handle<JSObject> object,
1094 Handle<JSObject> holder, 1093 Handle<JSObject> holder,
1095 Register receiver, 1094 Register receiver,
1096 Register scratch1, 1095 Register scratch1,
1097 Register scratch2, 1096 Register scratch2,
1098 Register scratch3, 1097 Register scratch3,
1099 int index, 1098 int index,
1100 Handle<String> name, 1099 Handle<String> name,
1101 Label* miss) { 1100 Label* miss) {
1102 // Check that the receiver isn't a smi. 1101 // Check that the receiver isn't a smi.
1103 __ And(scratch1, receiver, Operand(kSmiTagMask)); 1102 __ JumpIfSmi(receiver, miss);
1104 __ Branch(miss, eq, scratch1, Operand(zero_reg));
1105 1103
1106 // Check that the maps haven't changed. 1104 // Check that the maps haven't changed.
1107 Register reg = CheckPrototypes( 1105 Register reg = CheckPrototypes(
1108 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); 1106 object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1109 GenerateFastPropertyLoad(masm(), v0, reg, holder, index); 1107 GenerateFastPropertyLoad(masm(), v0, reg, holder, index);
1110 __ Ret(); 1108 __ Ret();
1111 } 1109 }
1112 1110
1113 1111
1114 void StubCompiler::GenerateLoadConstant(Handle<JSObject> object, 1112 void StubCompiler::GenerateLoadConstant(Handle<JSObject> object,
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2257 Label miss; 2255 Label miss;
2258 2256
2259 GenerateNameCheck(name, &miss); 2257 GenerateNameCheck(name, &miss);
2260 2258
2261 // Get the receiver from the stack. 2259 // Get the receiver from the stack.
2262 const int argc = arguments().immediate(); 2260 const int argc = arguments().immediate();
2263 __ lw(a1, MemOperand(sp, argc * kPointerSize)); 2261 __ lw(a1, MemOperand(sp, argc * kPointerSize));
2264 2262
2265 // Check that the receiver isn't a smi. 2263 // Check that the receiver isn't a smi.
2266 if (check != NUMBER_CHECK) { 2264 if (check != NUMBER_CHECK) {
2267 __ And(t1, a1, Operand(kSmiTagMask)); 2265 __ JumpIfSmi(a1, &miss);
2268 __ Branch(&miss, eq, t1, Operand(zero_reg));
2269 } 2266 }
2270 2267
2271 // Make sure that it's okay not to patch the on stack receiver 2268 // Make sure that it's okay not to patch the on stack receiver
2272 // unless we're doing a receiver map check. 2269 // unless we're doing a receiver map check.
2273 ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); 2270 ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK);
2274 switch (check) { 2271 switch (check) {
2275 case RECEIVER_MAP_CHECK: 2272 case RECEIVER_MAP_CHECK:
2276 __ IncrementCounter(masm()->isolate()->counters()->call_const(), 2273 __ IncrementCounter(masm()->isolate()->counters()->call_const(),
2277 1, a0, a3); 2274 1, a0, a3);
2278 2275
(...skipping 24 matching lines...) Expand all
2303 // Calling non-strict non-builtins with a value as the receiver 2300 // Calling non-strict non-builtins with a value as the receiver
2304 // requires boxing. 2301 // requires boxing.
2305 __ jmp(&miss); 2302 __ jmp(&miss);
2306 } 2303 }
2307 break; 2304 break;
2308 2305
2309 case NUMBER_CHECK: 2306 case NUMBER_CHECK:
2310 if (function->IsBuiltin() || function->shared()->strict_mode()) { 2307 if (function->IsBuiltin() || function->shared()->strict_mode()) {
2311 Label fast; 2308 Label fast;
2312 // Check that the object is a smi or a heap number. 2309 // Check that the object is a smi or a heap number.
2313 __ And(t1, a1, Operand(kSmiTagMask)); 2310 __ JumpIfSmi(a1, &fast);
2314 __ Branch(&fast, eq, t1, Operand(zero_reg));
2315 __ GetObjectType(a1, a0, a0); 2311 __ GetObjectType(a1, a0, a0);
2316 __ Branch(&miss, ne, a0, Operand(HEAP_NUMBER_TYPE)); 2312 __ Branch(&miss, ne, a0, Operand(HEAP_NUMBER_TYPE));
2317 __ bind(&fast); 2313 __ bind(&fast);
2318 // Check that the maps starting from the prototype haven't changed. 2314 // Check that the maps starting from the prototype haven't changed.
2319 GenerateDirectLoadGlobalFunctionPrototype( 2315 GenerateDirectLoadGlobalFunctionPrototype(
2320 masm(), Context::NUMBER_FUNCTION_INDEX, a0, &miss); 2316 masm(), Context::NUMBER_FUNCTION_INDEX, a0, &miss);
2321 CheckPrototypes( 2317 CheckPrototypes(
2322 Handle<JSObject>(JSObject::cast(object->GetPrototype())), 2318 Handle<JSObject>(JSObject::cast(object->GetPrototype())),
2323 a0, holder, a3, a1, t0, name, &miss); 2319 a0, holder, a3, a1, t0, name, &miss);
2324 } else { 2320 } else {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 // -- a0 : receiver 2764 // -- a0 : receiver
2769 // -- a2 : name 2765 // -- a2 : name
2770 // -- ra : return address 2766 // -- ra : return address
2771 // ----------------------------------- 2767 // -----------------------------------
2772 Label miss; 2768 Label miss;
2773 2769
2774 // If the object is the holder then we know that it's a global 2770 // If the object is the holder then we know that it's a global
2775 // object which can only happen for contextual calls. In this case, 2771 // object which can only happen for contextual calls. In this case,
2776 // the receiver cannot be a smi. 2772 // the receiver cannot be a smi.
2777 if (!object.is_identical_to(holder)) { 2773 if (!object.is_identical_to(holder)) {
2778 __ And(t0, a0, Operand(kSmiTagMask)); 2774 __ JumpIfSmi(a0, &miss);
2779 __ Branch(&miss, eq, t0, Operand(zero_reg));
2780 } 2775 }
2781 2776
2782 // Check that the map of the global has not changed. 2777 // Check that the map of the global has not changed.
2783 CheckPrototypes(object, a0, holder, a3, t0, a1, name, &miss); 2778 CheckPrototypes(object, a0, holder, a3, t0, a1, name, &miss);
2784 2779
2785 // Get the value from the cell. 2780 // Get the value from the cell.
2786 __ li(a3, Operand(cell)); 2781 __ li(a3, Operand(cell));
2787 __ lw(t0, FieldMemOperand(a3, JSGlobalPropertyCell::kValueOffset)); 2782 __ lw(t0, FieldMemOperand(a3, JSGlobalPropertyCell::kValueOffset));
2788 2783
2789 // Check for deleted property if property can actually be deleted. 2784 // Check for deleted property if property can actually be deleted.
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
3129 // code for the function thereby hitting the break points. 3124 // code for the function thereby hitting the break points.
3130 __ lw(t5, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 3125 __ lw(t5, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
3131 __ lw(a2, FieldMemOperand(t5, SharedFunctionInfo::kDebugInfoOffset)); 3126 __ lw(a2, FieldMemOperand(t5, SharedFunctionInfo::kDebugInfoOffset));
3132 __ Branch(&generic_stub_call, ne, a2, Operand(t7)); 3127 __ Branch(&generic_stub_call, ne, a2, Operand(t7));
3133 #endif 3128 #endif
3134 3129
3135 // Load the initial map and verify that it is in fact a map. 3130 // Load the initial map and verify that it is in fact a map.
3136 // a1: constructor function 3131 // a1: constructor function
3137 // t7: undefined 3132 // t7: undefined
3138 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); 3133 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
3139 __ And(t0, a2, Operand(kSmiTagMask)); 3134 __ JumpIfSmi(a2, &generic_stub_call);
3140 __ Branch(&generic_stub_call, eq, t0, Operand(zero_reg));
3141 __ GetObjectType(a2, a3, t0); 3135 __ GetObjectType(a2, a3, t0);
3142 __ Branch(&generic_stub_call, ne, t0, Operand(MAP_TYPE)); 3136 __ Branch(&generic_stub_call, ne, t0, Operand(MAP_TYPE));
3143 3137
3144 #ifdef DEBUG 3138 #ifdef DEBUG
3145 // Cannot construct functions this way. 3139 // Cannot construct functions this way.
3146 // a0: argc 3140 // a0: argc
3147 // a1: constructor function 3141 // a1: constructor function
3148 // a2: initial map 3142 // a2: initial map
3149 // t7: undefined 3143 // t7: undefined
3150 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceTypeOffset)); 3144 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceTypeOffset));
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
4323 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); 4317 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss();
4324 __ Jump(ic_miss, RelocInfo::CODE_TARGET); 4318 __ Jump(ic_miss, RelocInfo::CODE_TARGET);
4325 } 4319 }
4326 4320
4327 4321
4328 #undef __ 4322 #undef __
4329 4323
4330 } } // namespace v8::internal 4324 } } // namespace v8::internal
4331 4325
4332 #endif // V8_TARGET_ARCH_MIPS 4326 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698