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

Side by Side Diff: src/builtins/builtins-math.cc

Issue 2452543003: Don't wrap roots in Handle just to dereference immediately. (Closed)
Patch Set: Created 4 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/builtins/builtins-error.cc ('k') | src/builtins/builtins-string.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins/builtins.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 max = abs_value; 334 max = abs_value;
335 } 335 }
336 } 336 }
337 } 337 }
338 338
339 if (max == V8_INFINITY) { 339 if (max == V8_INFINITY) {
340 return *isolate->factory()->NewNumber(V8_INFINITY); 340 return *isolate->factory()->NewNumber(V8_INFINITY);
341 } 341 }
342 342
343 if (one_arg_is_nan) { 343 if (one_arg_is_nan) {
344 return *isolate->factory()->nan_value(); 344 return isolate->heap()->nan_value();
345 } 345 }
346 346
347 if (max == 0) { 347 if (max == 0) {
348 return Smi::kZero; 348 return Smi::kZero;
349 } 349 }
350 DCHECK_GT(max, 0); 350 DCHECK_GT(max, 0);
351 351
352 // Kahan summation to avoid rounding errors. 352 // Kahan summation to avoid rounding errors.
353 // Normalize the numbers to the largest one to avoid overflow. 353 // Normalize the numbers to the largest one to avoid overflow.
354 double sum = 0; 354 double sum = 0;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 void Builtins::Generate_MathMax(MacroAssembler* masm) { 592 void Builtins::Generate_MathMax(MacroAssembler* masm) {
593 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); 593 Generate_MathMaxMin(masm, MathMaxMinKind::kMax);
594 } 594 }
595 595
596 void Builtins::Generate_MathMin(MacroAssembler* masm) { 596 void Builtins::Generate_MathMin(MacroAssembler* masm) {
597 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); 597 Generate_MathMaxMin(masm, MathMaxMinKind::kMin);
598 } 598 }
599 599
600 } // namespace internal 600 } // namespace internal
601 } // namespace v8 601 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-error.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698