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

Side by Side Diff: src/hydrogen.cc

Issue 1378533002: [es6] Introduce %ToInteger and %ToLength. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/hydrogen.h ('k') | src/json.js » ('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 <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast-numbering.h" 10 #include "src/ast-numbering.h"
(...skipping 12199 matching lines...) Expand 10 before | Expand all | Expand 10 after
12210 void HOptimizedGraphBuilder::GenerateIsRegExp(CallRuntime* call) { 12210 void HOptimizedGraphBuilder::GenerateIsRegExp(CallRuntime* call) {
12211 DCHECK(call->arguments()->length() == 1); 12211 DCHECK(call->arguments()->length() == 1);
12212 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 12212 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12213 HValue* value = Pop(); 12213 HValue* value = Pop();
12214 HHasInstanceTypeAndBranch* result = 12214 HHasInstanceTypeAndBranch* result =
12215 New<HHasInstanceTypeAndBranch>(value, JS_REGEXP_TYPE); 12215 New<HHasInstanceTypeAndBranch>(value, JS_REGEXP_TYPE);
12216 return ast_context()->ReturnControl(result, call->id()); 12216 return ast_context()->ReturnControl(result, call->id());
12217 } 12217 }
12218 12218
12219 12219
12220 void HOptimizedGraphBuilder::GenerateToInteger(CallRuntime* call) {
12221 DCHECK_EQ(1, call->arguments()->length());
12222 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12223 HValue* input = Pop();
12224 if (input->type().IsSmi()) {
12225 return ast_context()->ReturnValue(input);
12226 } else {
12227 IfBuilder if_inputissmi(this);
12228 if_inputissmi.If<HIsSmiAndBranch>(input);
12229 if_inputissmi.Then();
12230 {
12231 // Return the input value.
12232 Push(input);
12233 Add<HSimulate>(call->id(), FIXED_SIMULATE);
12234 }
12235 if_inputissmi.Else();
12236 {
12237 Add<HPushArguments>(input);
12238 Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kToInteger), 1));
12239 Add<HSimulate>(call->id(), FIXED_SIMULATE);
12240 }
12241 if_inputissmi.End();
12242 return ast_context()->ReturnValue(Pop());
12243 }
12244 }
12245
12246
12220 void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) { 12247 void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) {
12221 DCHECK_EQ(1, call->arguments()->length()); 12248 DCHECK_EQ(1, call->arguments()->length());
12222 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 12249 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12223 HValue* value = Pop(); 12250 HValue* value = Pop();
12224 HValue* result = BuildToObject(value); 12251 HValue* result = BuildToObject(value);
12225 return ast_context()->ReturnValue(result); 12252 return ast_context()->ReturnValue(result);
12226 } 12253 }
12227 12254
12228 12255
12229 void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) { 12256 void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) {
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
13618 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13645 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13619 } 13646 }
13620 13647
13621 #ifdef DEBUG 13648 #ifdef DEBUG
13622 graph_->Verify(false); // No full verify. 13649 graph_->Verify(false); // No full verify.
13623 #endif 13650 #endif
13624 } 13651 }
13625 13652
13626 } // namespace internal 13653 } // namespace internal
13627 } // namespace v8 13654 } // namespace v8
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698