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

Side by Side Diff: src/compiler/js-call-reducer.cc

Issue 2035383003: [turbofan] Type feedback for numeric comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase, pure ops Created 4 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
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/compiler/js-operator.h » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compiler/js-call-reducer.h" 5 #include "src/compiler/js-call-reducer.h"
6 6
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 #include "src/type-feedback-vector-inl.h" 10 #include "src/type-feedback-vector-inl.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } else { 316 } else {
317 Node* native_context = effect = graph()->NewNode( 317 Node* native_context = effect = graph()->NewNode(
318 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), 318 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
319 context, context, effect); 319 context, context, effect);
320 array_function = effect = graph()->NewNode( 320 array_function = effect = graph()->NewNode(
321 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true), 321 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true),
322 native_context, native_context, effect); 322 native_context, native_context, effect);
323 } 323 }
324 324
325 // Check that the {target} is still the {array_function}. 325 // Check that the {target} is still the {array_function}.
326 Node* check = graph()->NewNode(javascript()->StrictEqual(), target, 326 Node* check = graph()->NewNode(
327 array_function, context); 327 javascript()->StrictEqual(CompareOperationHints::Any()), target,
328 array_function, context);
328 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, 329 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
329 frame_state, effect, control); 330 frame_state, effect, control);
330 331
331 // Turn the {node} into a {JSCreateArray} call. 332 // Turn the {node} into a {JSCreateArray} call.
332 NodeProperties::ReplaceValueInput(node, array_function, 0); 333 NodeProperties::ReplaceValueInput(node, array_function, 0);
333 NodeProperties::ReplaceEffectInput(node, effect); 334 NodeProperties::ReplaceEffectInput(node, effect);
334 NodeProperties::ReplaceControlInput(node, control); 335 NodeProperties::ReplaceControlInput(node, control);
335 return ReduceArrayConstructor(node); 336 return ReduceArrayConstructor(node);
336 } else if (feedback->IsWeakCell()) { 337 } else if (feedback->IsWeakCell()) {
337 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback); 338 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback);
338 if (cell->value()->IsJSFunction()) { 339 if (cell->value()->IsJSFunction()) {
339 Node* target_function = 340 Node* target_function =
340 jsgraph()->Constant(handle(cell->value(), isolate())); 341 jsgraph()->Constant(handle(cell->value(), isolate()));
341 342
342 // Check that the {target} is still the {target_function}. 343 // Check that the {target} is still the {target_function}.
343 Node* check = graph()->NewNode(javascript()->StrictEqual(), target, 344 Node* check = graph()->NewNode(
344 target_function, context); 345 javascript()->StrictEqual(CompareOperationHints::Any()), target,
346 target_function, context);
345 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, 347 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
346 frame_state, effect, control); 348 frame_state, effect, control);
347 349
348 // Specialize the JSCallFunction node to the {target_function}. 350 // Specialize the JSCallFunction node to the {target_function}.
349 NodeProperties::ReplaceValueInput(node, target_function, 0); 351 NodeProperties::ReplaceValueInput(node, target_function, 0);
350 NodeProperties::ReplaceEffectInput(node, effect); 352 NodeProperties::ReplaceEffectInput(node, effect);
351 NodeProperties::ReplaceControlInput(node, control); 353 NodeProperties::ReplaceControlInput(node, control);
352 354
353 // Try to further reduce the JSCallFunction {node}. 355 // Try to further reduce the JSCallFunction {node}.
354 Reduction const reduction = ReduceJSCallFunction(node); 356 Reduction const reduction = ReduceJSCallFunction(node);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } else { 438 } else {
437 Node* native_context = effect = graph()->NewNode( 439 Node* native_context = effect = graph()->NewNode(
438 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), 440 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
439 context, context, effect); 441 context, context, effect);
440 array_function = effect = graph()->NewNode( 442 array_function = effect = graph()->NewNode(
441 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true), 443 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true),
442 native_context, native_context, effect); 444 native_context, native_context, effect);
443 } 445 }
444 446
445 // Check that the {target} is still the {array_function}. 447 // Check that the {target} is still the {array_function}.
446 Node* check = graph()->NewNode(javascript()->StrictEqual(), target, 448 Node* check = graph()->NewNode(
447 array_function, context); 449 javascript()->StrictEqual(CompareOperationHints::Any()), target,
450 array_function, context);
448 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, 451 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
449 frame_state, effect, control); 452 frame_state, effect, control);
450 453
451 // Turn the {node} into a {JSCreateArray} call. 454 // Turn the {node} into a {JSCreateArray} call.
452 NodeProperties::ReplaceEffectInput(node, effect); 455 NodeProperties::ReplaceEffectInput(node, effect);
453 NodeProperties::ReplaceControlInput(node, control); 456 NodeProperties::ReplaceControlInput(node, control);
454 for (int i = arity; i > 0; --i) { 457 for (int i = arity; i > 0; --i) {
455 NodeProperties::ReplaceValueInput( 458 NodeProperties::ReplaceValueInput(
456 node, NodeProperties::GetValueInput(node, i), i + 1); 459 node, NodeProperties::GetValueInput(node, i), i + 1);
457 } 460 }
458 NodeProperties::ReplaceValueInput(node, new_target, 1); 461 NodeProperties::ReplaceValueInput(node, new_target, 1);
459 NodeProperties::ChangeOp(node, javascript()->CreateArray(arity, site)); 462 NodeProperties::ChangeOp(node, javascript()->CreateArray(arity, site));
460 return Changed(node); 463 return Changed(node);
461 } else if (feedback->IsWeakCell()) { 464 } else if (feedback->IsWeakCell()) {
462 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback); 465 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback);
463 if (cell->value()->IsJSFunction()) { 466 if (cell->value()->IsJSFunction()) {
464 Node* target_function = 467 Node* target_function =
465 jsgraph()->Constant(handle(cell->value(), isolate())); 468 jsgraph()->Constant(handle(cell->value(), isolate()));
466 469
467 // Check that the {target} is still the {target_function}. 470 // Check that the {target} is still the {target_function}.
468 Node* check = graph()->NewNode(javascript()->StrictEqual(), target, 471 Node* check = graph()->NewNode(
469 target_function, context); 472 javascript()->StrictEqual(CompareOperationHints::Any()), target,
473 target_function, context);
470 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, 474 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
471 frame_state, effect, control); 475 frame_state, effect, control);
472 476
473 // Specialize the JSCallConstruct node to the {target_function}. 477 // Specialize the JSCallConstruct node to the {target_function}.
474 NodeProperties::ReplaceValueInput(node, target_function, 0); 478 NodeProperties::ReplaceValueInput(node, target_function, 0);
475 NodeProperties::ReplaceEffectInput(node, effect); 479 NodeProperties::ReplaceEffectInput(node, effect);
476 NodeProperties::ReplaceControlInput(node, control); 480 NodeProperties::ReplaceControlInput(node, control);
477 if (target == new_target) { 481 if (target == new_target) {
478 NodeProperties::ReplaceValueInput(node, target_function, arity + 1); 482 NodeProperties::ReplaceValueInput(node, target_function, arity + 1);
479 } 483 }
(...skipping 26 matching lines...) Expand all
506 } 510 }
507 511
508 512
509 JSOperatorBuilder* JSCallReducer::javascript() const { 513 JSOperatorBuilder* JSCallReducer::javascript() const {
510 return jsgraph()->javascript(); 514 return jsgraph()->javascript();
511 } 515 }
512 516
513 } // namespace compiler 517 } // namespace compiler
514 } // namespace internal 518 } // namespace internal
515 } // namespace v8 519 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698