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

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 16361004: MIPS : Collect type feedback for power-of-2 right operands in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 if (allow_heapnumber_results == BinaryOpStub::ALLOW_HEAPNUMBER_RESULTS) { 2270 if (allow_heapnumber_results == BinaryOpStub::ALLOW_HEAPNUMBER_RESULTS) {
2271 BinaryOpStub_GenerateFPOperation( 2271 BinaryOpStub_GenerateFPOperation(
2272 masm, BinaryOpIC::UNINITIALIZED, BinaryOpIC::UNINITIALIZED, true, 2272 masm, BinaryOpIC::UNINITIALIZED, BinaryOpIC::UNINITIALIZED, true,
2273 use_runtime, gc_required, &not_smis, op, mode); 2273 use_runtime, gc_required, &not_smis, op, mode);
2274 } 2274 }
2275 __ bind(&not_smis); 2275 __ bind(&not_smis);
2276 } 2276 }
2277 2277
2278 2278
2279 void BinaryOpStub::GenerateSmiStub(MacroAssembler* masm) { 2279 void BinaryOpStub::GenerateSmiStub(MacroAssembler* masm) {
2280 Label not_smis, call_runtime; 2280 Label right_arg_changed, call_runtime;
2281
2282 if (op_ == Token::MOD && has_fixed_right_arg_) {
2283 // It is guaranteed that the value will fit into a Smi, because if it
2284 // didn't, we wouldn't be here, see BinaryOp_Patch.
2285 __ Branch(&right_arg_changed,
2286 ne,
2287 a0,
2288 Operand(Smi::FromInt(fixed_right_arg_value())));
2289 }
2281 2290
2282 if (result_type_ == BinaryOpIC::UNINITIALIZED || 2291 if (result_type_ == BinaryOpIC::UNINITIALIZED ||
2283 result_type_ == BinaryOpIC::SMI) { 2292 result_type_ == BinaryOpIC::SMI) {
2284 // Only allow smi results. 2293 // Only allow smi results.
2285 BinaryOpStub_GenerateSmiCode( 2294 BinaryOpStub_GenerateSmiCode(
2286 masm, &call_runtime, NULL, op_, NO_HEAPNUMBER_RESULTS, mode_); 2295 masm, &call_runtime, NULL, op_, NO_HEAPNUMBER_RESULTS, mode_);
2287 } else { 2296 } else {
2288 // Allow heap number result and don't make a transition if a heap number 2297 // Allow heap number result and don't make a transition if a heap number
2289 // cannot be allocated. 2298 // cannot be allocated.
2290 BinaryOpStub_GenerateSmiCode( 2299 BinaryOpStub_GenerateSmiCode(
2291 masm, &call_runtime, &call_runtime, op_, ALLOW_HEAPNUMBER_RESULTS, 2300 masm, &call_runtime, &call_runtime, op_, ALLOW_HEAPNUMBER_RESULTS,
2292 mode_); 2301 mode_);
2293 } 2302 }
2294 2303
2295 // Code falls through if the result is not returned as either a smi or heap 2304 // Code falls through if the result is not returned as either a smi or heap
2296 // number. 2305 // number.
2306 __ bind(&right_arg_changed);
2297 GenerateTypeTransition(masm); 2307 GenerateTypeTransition(masm);
2298 2308
2299 __ bind(&call_runtime); 2309 __ bind(&call_runtime);
2300 { 2310 {
2301 FrameScope scope(masm, StackFrame::INTERNAL); 2311 FrameScope scope(masm, StackFrame::INTERNAL);
2302 GenerateRegisterArgsPush(masm); 2312 GenerateRegisterArgsPush(masm);
2303 GenerateCallRuntime(masm); 2313 GenerateCallRuntime(masm);
2304 } 2314 }
2305 __ Ret(); 2315 __ Ret();
2306 } 2316 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 &call_runtime, 2497 &call_runtime,
2488 mode_); 2498 mode_);
2489 __ mov(v0, heap_number_result); 2499 __ mov(v0, heap_number_result);
2490 __ sdc1(f10, FieldMemOperand(v0, HeapNumber::kValueOffset)); 2500 __ sdc1(f10, FieldMemOperand(v0, HeapNumber::kValueOffset));
2491 __ Ret(); 2501 __ Ret();
2492 2502
2493 // A DIV operation expecting an integer result falls through 2503 // A DIV operation expecting an integer result falls through
2494 // to type transition. 2504 // to type transition.
2495 2505
2496 } else { 2506 } else {
2507 if (has_fixed_right_arg_) {
2508 __ Move(f16, fixed_right_arg_value());
2509 __ BranchF(&transition, NULL, ne, f14, f16);
2510 }
2511
2497 // We preserved a0 and a1 to be able to call runtime. 2512 // We preserved a0 and a1 to be able to call runtime.
2498 // Save the left value on the stack. 2513 // Save the left value on the stack.
2499 __ Push(t1, t0); 2514 __ Push(t1, t0);
2500 2515
2501 Label pop_and_call_runtime; 2516 Label pop_and_call_runtime;
2502 2517
2503 // Allocate a heap number to store the result. 2518 // Allocate a heap number to store the result.
2504 heap_number_result = s0; 2519 heap_number_result = s0;
2505 BinaryOpStub_GenerateHeapResultAllocation(masm, 2520 BinaryOpStub_GenerateHeapResultAllocation(masm,
2506 heap_number_result, 2521 heap_number_result,
(...skipping 5234 matching lines...) Expand 10 before | Expand all | Expand 10 after
7741 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 7756 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
7742 } 7757 }
7743 } 7758 }
7744 7759
7745 7760
7746 #undef __ 7761 #undef __
7747 7762
7748 } } // namespace v8::internal 7763 } } // namespace v8::internal
7749 7764
7750 #endif // V8_TARGET_ARCH_MIPS 7765 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698