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

Side by Side Diff: src/runtime.cc

Issue 8817015: Remove early NaN/Infinity check in MathPowStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: switch -0.5 and +0.5 checks Created 9 years 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/ia32/code-stubs-ia32.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 7396 matching lines...) Expand 10 before | Expand all | Expand 10 after
7407 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 7407 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7408 7408
7409 // If the second argument is a smi, it is much faster to call the 7409 // If the second argument is a smi, it is much faster to call the
7410 // custom powi() function than the generic pow(). 7410 // custom powi() function than the generic pow().
7411 if (args[1]->IsSmi()) { 7411 if (args[1]->IsSmi()) {
7412 int y = args.smi_at(1); 7412 int y = args.smi_at(1);
7413 return isolate->heap()->NumberFromDouble(power_double_int(x, y)); 7413 return isolate->heap()->NumberFromDouble(power_double_int(x, y));
7414 } 7414 }
7415 7415
7416 CONVERT_DOUBLE_ARG_CHECKED(y, 1); 7416 CONVERT_DOUBLE_ARG_CHECKED(y, 1);
7417 // Returning a smi would not confuse crankshaft as this part of code is only
7418 // run if SSE2 was not available, in which case crankshaft is disabled.
7419 if (y == 0) return Smi::FromInt(1); // Returns 1 if exponent is 0.
7417 return isolate->heap()->AllocateHeapNumber(power_double_double(x, y)); 7420 return isolate->heap()->AllocateHeapNumber(power_double_double(x, y));
7418 } 7421 }
7419 7422
7420 // Fast version of Math.pow if we know that y is not an integer and 7423 // Fast version of Math.pow if we know that y is not an integer and
7421 // y is not -0.5 or 0.5. Used as slowcase from codegen. 7424 // y is not -0.5 or 0.5. Used as slowcase from codegen.
7422 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow_cfunction) { 7425 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow_cfunction) {
7423 NoHandleAllocation ha; 7426 NoHandleAllocation ha;
7424 ASSERT(args.length() == 2); 7427 ASSERT(args.length() == 2);
7425 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 7428 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7426 CONVERT_DOUBLE_ARG_CHECKED(y, 1); 7429 CONVERT_DOUBLE_ARG_CHECKED(y, 1);
(...skipping 6138 matching lines...) Expand 10 before | Expand all | Expand 10 after
13565 } else { 13568 } else {
13566 // Handle last resort GC and make sure to allow future allocations 13569 // Handle last resort GC and make sure to allow future allocations
13567 // to grow the heap without causing GCs (if possible). 13570 // to grow the heap without causing GCs (if possible).
13568 isolate->counters()->gc_last_resort_from_js()->Increment(); 13571 isolate->counters()->gc_last_resort_from_js()->Increment();
13569 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); 13572 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags);
13570 } 13573 }
13571 } 13574 }
13572 13575
13573 13576
13574 } } // namespace v8::internal 13577 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698