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

Side by Side Diff: src/hydrogen.cc

Issue 319343002: Bugfix in inlined versions of Array.indexOf() and Array.lastIndexOf() with a regression test. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing Created 6 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 | src/hydrogen-instructions.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 8506 matching lines...) Expand 10 before | Expand all | Expand 10 after
8517 Drop(1); 8517 Drop(1);
8518 Push(index); 8518 Push(index);
8519 loop.Break(); 8519 loop.Break();
8520 } 8520 }
8521 if_issame.End(); 8521 if_issame.End();
8522 } 8522 }
8523 loop.EndBody(); 8523 loop.EndBody();
8524 } 8524 }
8525 if_isstring.Else(); 8525 if_isstring.Else();
8526 { 8526 {
8527 IfBuilder if_isheapnumber(this); 8527 IfBuilder if_isnumber(this);
8528 if_isheapnumber.IfNot<HIsSmiAndBranch>(search_element); 8528 if_isnumber.If<HIsSmiAndBranch>(search_element);
8529 HCompareMap* isheapnumber = if_isheapnumber.AndIf<HCompareMap>( 8529 if_isnumber.OrIf<HCompareMap>(
8530 search_element, isolate()->factory()->heap_number_map()); 8530 search_element, isolate()->factory()->heap_number_map());
8531 if_isheapnumber.Then(); 8531 if_isnumber.Then();
8532 { 8532 {
8533 HValue* search_number = Add<HLoadNamedField>( 8533 HValue* search_number =
8534 search_element, isheapnumber, 8534 AddUncasted<HForceRepresentation>(search_element,
8535 HObjectAccess::ForHeapNumberValue()); 8535 Representation::Double());
8536 LoopBuilder loop(this, context(), direction); 8536 LoopBuilder loop(this, context(), direction);
8537 { 8537 {
8538 HValue* index = loop.BeginBody(initial, terminating, token); 8538 HValue* index = loop.BeginBody(initial, terminating, token);
8539 HValue* element = AddUncasted<HLoadKeyed>( 8539 HValue* element = AddUncasted<HLoadKeyed>(
8540 elements, index, static_cast<HValue*>(NULL), 8540 elements, index, static_cast<HValue*>(NULL),
8541 kind, ALLOW_RETURN_HOLE); 8541 kind, ALLOW_RETURN_HOLE);
8542 IfBuilder if_issame(this); 8542
8543 if_issame.IfNot<HIsSmiAndBranch>(element); 8543 IfBuilder if_element_isnumber(this);
8544 HCompareMap* issame = if_issame.AndIf<HCompareMap>( 8544 if_element_isnumber.If<HIsSmiAndBranch>(element);
8545 if_element_isnumber.OrIf<HCompareMap>(
8545 element, isolate()->factory()->heap_number_map()); 8546 element, isolate()->factory()->heap_number_map());
8546 if_issame.And(); 8547 if_element_isnumber.Then();
8547 HValue* number = Add<HLoadNamedField>(
8548 element, issame, HObjectAccess::ForHeapNumberValue());
8549 if_issame.If<HCompareNumericAndBranch>(
8550 number, search_number, Token::EQ_STRICT);
8551 if_issame.Then();
8552 { 8548 {
8553 Drop(1); 8549 HValue* number =
8554 Push(index); 8550 AddUncasted<HForceRepresentation>(element,
8555 loop.Break(); 8551 Representation::Double());
8552 IfBuilder if_issame(this);
8553 if_issame.If<HCompareNumericAndBranch>(
8554 number, search_number, Token::EQ_STRICT);
8555 if_issame.Then();
8556 {
8557 Drop(1);
8558 Push(index);
8559 loop.Break();
8560 }
8561 if_issame.End();
8556 } 8562 }
8557 if_issame.End(); 8563 if_element_isnumber.End();
8558 } 8564 }
8559 loop.EndBody(); 8565 loop.EndBody();
8560 } 8566 }
8561 if_isheapnumber.Else(); 8567 if_isnumber.Else();
8562 { 8568 {
8563 LoopBuilder loop(this, context(), direction); 8569 LoopBuilder loop(this, context(), direction);
8564 { 8570 {
8565 HValue* index = loop.BeginBody(initial, terminating, token); 8571 HValue* index = loop.BeginBody(initial, terminating, token);
8566 HValue* element = AddUncasted<HLoadKeyed>( 8572 HValue* element = AddUncasted<HLoadKeyed>(
8567 elements, index, static_cast<HValue*>(NULL), 8573 elements, index, static_cast<HValue*>(NULL),
8568 kind, ALLOW_RETURN_HOLE); 8574 kind, ALLOW_RETURN_HOLE);
8569 IfBuilder if_issame(this); 8575 IfBuilder if_issame(this);
8570 if_issame.If<HCompareObjectEqAndBranch>( 8576 if_issame.If<HCompareObjectEqAndBranch>(
8571 element, search_element); 8577 element, search_element);
8572 if_issame.Then(); 8578 if_issame.Then();
8573 { 8579 {
8574 Drop(1); 8580 Drop(1);
8575 Push(index); 8581 Push(index);
8576 loop.Break(); 8582 loop.Break();
8577 } 8583 }
8578 if_issame.End(); 8584 if_issame.End();
8579 } 8585 }
8580 loop.EndBody(); 8586 loop.EndBody();
8581 } 8587 }
8582 if_isheapnumber.End(); 8588 if_isnumber.End();
8583 } 8589 }
8584 if_isstring.End(); 8590 if_isstring.End();
8585 } 8591 }
8586 8592
8587 return Pop(); 8593 return Pop();
8588 } 8594 }
8589 8595
8590 8596
8591 bool HOptimizedGraphBuilder::TryHandleArrayCall(Call* expr, HValue* function) { 8597 bool HOptimizedGraphBuilder::TryHandleArrayCall(Call* expr, HValue* function) {
8592 if (!array_function().is_identical_to(expr->target())) { 8598 if (!array_function().is_identical_to(expr->target())) {
(...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after
12142 if (ShouldProduceTraceOutput()) { 12148 if (ShouldProduceTraceOutput()) {
12143 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12149 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12144 } 12150 }
12145 12151
12146 #ifdef DEBUG 12152 #ifdef DEBUG
12147 graph_->Verify(false); // No full verify. 12153 graph_->Verify(false); // No full verify.
12148 #endif 12154 #endif
12149 } 12155 }
12150 12156
12151 } } // namespace v8::internal 12157 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698