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

Side by Side Diff: src/ic/ic.cc

Issue 857783002: [turbofan] Make Factory::NewNumber() always return the minus_zero_value. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More tests. Created 5 years, 11 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
« no previous file with comments | « src/factory.cc ('k') | test/unittests/factory-unittest.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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 BinaryOpICState state(isolate(), target()->extra_ic_state()); 2492 BinaryOpICState state(isolate(), target()->extra_ic_state());
2493 2493
2494 // Compute the actual result using the builtin for the binary operation. 2494 // Compute the actual result using the builtin for the binary operation.
2495 Object* builtin = isolate()->js_builtins_object()->javascript_builtin( 2495 Object* builtin = isolate()->js_builtins_object()->javascript_builtin(
2496 TokenToJSBuiltin(state.op())); 2496 TokenToJSBuiltin(state.op()));
2497 Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate()); 2497 Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate());
2498 Handle<Object> result; 2498 Handle<Object> result;
2499 ASSIGN_RETURN_ON_EXCEPTION( 2499 ASSIGN_RETURN_ON_EXCEPTION(
2500 isolate(), result, Execution::Call(isolate(), function, left, 1, &right), 2500 isolate(), result, Execution::Call(isolate(), function, left, 1, &right),
2501 Object); 2501 Object);
2502 if (result->IsHeapNumber()) {
2503 // If the result of this BinaryOpIC is used as left or right hand side of
2504 // another binary operation, full-codegen.cc might have decided that its
2505 // safe to reuse the double box returned by this BinaryOpIC, but the builtin
2506 // above does not know or care about this fact and might return a canonical
2507 // value (i.e. the global minus zero constant), which we would then
2508 // overwrite in the surrounding binary operation. So to be safe, we need to
2509 // take a copy of heap numbers here.
2510 result = isolate()->factory()->NewHeapNumber(result->Number());
2511 }
2512 DCHECK(!result.is_identical_to(isolate()->factory()->nan_value()));
2513 DCHECK(!result.is_identical_to(isolate()->factory()->infinity_value()));
2514 DCHECK(!result.is_identical_to(isolate()->factory()->minus_zero_value()));
2502 2515
2503 // Execution::Call can execute arbitrary JavaScript, hence potentially 2516 // Execution::Call can execute arbitrary JavaScript, hence potentially
2504 // update the state of this very IC, so we must update the stored state. 2517 // update the state of this very IC, so we must update the stored state.
2505 UpdateTarget(); 2518 UpdateTarget();
2506 // Compute the new state. 2519 // Compute the new state.
2507 BinaryOpICState old_state(isolate(), target()->extra_ic_state()); 2520 BinaryOpICState old_state(isolate(), target()->extra_ic_state());
2508 state.Update(left, right, result); 2521 state.Update(left, right, result);
2509 2522
2510 // Check if we have a string operation here. 2523 // Check if we have a string operation here.
2511 Handle<Code> target; 2524 Handle<Code> target;
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
2977 static const Address IC_utilities[] = { 2990 static const Address IC_utilities[] = {
2978 #define ADDR(name) FUNCTION_ADDR(name), 2991 #define ADDR(name) FUNCTION_ADDR(name),
2979 IC_UTIL_LIST(ADDR) NULL 2992 IC_UTIL_LIST(ADDR) NULL
2980 #undef ADDR 2993 #undef ADDR
2981 }; 2994 };
2982 2995
2983 2996
2984 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 2997 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
2985 } 2998 }
2986 } // namespace v8::internal 2999 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | test/unittests/factory-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698