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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2367483003: Remove ARGUMENTS_VARIABLE and fix crankshaft to properly detect the arguments object and keep it al… (Closed)
Patch Set: Rebaseline more Created 4 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/crankshaft/hydrogen.h ('k') | src/globals.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 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/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 6916 matching lines...) Expand 10 before | Expand all | Expand 10 after
6927 if (expr->op() != Token::INIT) { 6927 if (expr->op() != Token::INIT) {
6928 if (var->throw_on_const_assignment(function_language_mode())) { 6928 if (var->throw_on_const_assignment(function_language_mode())) {
6929 return Bailout(kNonInitializerAssignmentToConst); 6929 return Bailout(kNonInitializerAssignmentToConst);
6930 } else { 6930 } else {
6931 CHECK_ALIVE(VisitForValue(expr->value())); 6931 CHECK_ALIVE(VisitForValue(expr->value()));
6932 return ast_context()->ReturnValue(Pop()); 6932 return ast_context()->ReturnValue(Pop());
6933 } 6933 }
6934 } 6934 }
6935 } 6935 }
6936 6936
6937 if (var->is_arguments()) return Bailout(kAssignmentToArguments);
6938
6939 // Handle the assignment. 6937 // Handle the assignment.
6940 switch (var->location()) { 6938 switch (var->location()) {
6941 case VariableLocation::UNALLOCATED: 6939 case VariableLocation::UNALLOCATED:
6942 CHECK_ALIVE(VisitForValue(expr->value())); 6940 CHECK_ALIVE(VisitForValue(expr->value()));
6943 HandleGlobalVariableAssignment(var, Top(), expr->AssignmentSlot(), 6941 HandleGlobalVariableAssignment(var, Top(), expr->AssignmentSlot(),
6944 expr->AssignmentId()); 6942 expr->AssignmentId());
6945 return ast_context()->ReturnValue(Pop()); 6943 return ast_context()->ReturnValue(Pop());
6946 6944
6947 case VariableLocation::PARAMETER: 6945 case VariableLocation::PARAMETER:
6948 case VariableLocation::LOCAL: { 6946 case VariableLocation::LOCAL: {
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after
9307 9305
9308 switch (expr->target()->shared()->builtin_function_id()) { 9306 switch (expr->target()->shared()->builtin_function_id()) {
9309 case kFunctionCall: { 9307 case kFunctionCall: {
9310 if (expr->arguments()->length() == 0) return false; 9308 if (expr->arguments()->length() == 0) return false;
9311 BuildFunctionCall(expr); 9309 BuildFunctionCall(expr);
9312 return true; 9310 return true;
9313 } 9311 }
9314 case kFunctionApply: { 9312 case kFunctionApply: {
9315 // For .apply, only the pattern f.apply(receiver, arguments) 9313 // For .apply, only the pattern f.apply(receiver, arguments)
9316 // is supported. 9314 // is supported.
9317 if (current_info()->scope()->arguments() == NULL) return false;
9318
9319 if (!CanBeFunctionApplyArguments(expr)) return false; 9315 if (!CanBeFunctionApplyArguments(expr)) return false;
9320 9316
9321 BuildFunctionApply(expr); 9317 BuildFunctionApply(expr);
9322 return true; 9318 return true;
9323 } 9319 }
9324 default: { return false; } 9320 default: { return false; }
9325 } 9321 }
9326 UNREACHABLE(); 9322 UNREACHABLE();
9327 } 9323 }
9328 9324
9329 9325
9330 // f.apply(...) 9326 // f.apply(...)
9331 void HOptimizedGraphBuilder::BuildFunctionApply(Call* expr) { 9327 void HOptimizedGraphBuilder::BuildFunctionApply(Call* expr) {
9332 ZoneList<Expression*>* args = expr->arguments(); 9328 ZoneList<Expression*>* args = expr->arguments();
9333 CHECK_ALIVE(VisitForValue(args->at(0))); 9329 CHECK_ALIVE(VisitForValue(args->at(0)));
9334 HValue* receiver = Pop(); // receiver 9330 HValue* receiver = Pop(); // receiver
9335 HValue* function = Pop(); // f 9331 HValue* function = Pop(); // f
9336 Drop(1); // apply 9332 Drop(1); // apply
9337 9333
9334 // Make sure the arguments object is live.
9335 VariableProxy* arg_two = args->at(1)->AsVariableProxy();
9336 LookupAndMakeLive(arg_two->var());
9337
9338 Handle<Map> function_map = expr->GetReceiverTypes()->first(); 9338 Handle<Map> function_map = expr->GetReceiverTypes()->first();
9339 HValue* checked_function = AddCheckMap(function, function_map); 9339 HValue* checked_function = AddCheckMap(function, function_map);
9340 9340
9341 if (function_state()->outer() == NULL) { 9341 if (function_state()->outer() == NULL) {
9342 TailCallMode syntactic_tail_call_mode = expr->tail_call_mode(); 9342 TailCallMode syntactic_tail_call_mode = expr->tail_call_mode();
9343 TailCallMode tail_call_mode = 9343 TailCallMode tail_call_mode =
9344 function_state()->ComputeTailCallMode(syntactic_tail_call_mode); 9344 function_state()->ComputeTailCallMode(syntactic_tail_call_mode);
9345 9345
9346 HInstruction* elements = Add<HArgumentsElements>(false); 9346 HInstruction* elements = Add<HArgumentsElements>(false);
9347 HInstruction* length = Add<HArgumentsLength>(elements); 9347 HInstruction* length = Add<HArgumentsLength>(elements);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
9573 9573
9574 return true; 9574 return true;
9575 } 9575 }
9576 9576
9577 9577
9578 bool HOptimizedGraphBuilder::CanBeFunctionApplyArguments(Call* expr) { 9578 bool HOptimizedGraphBuilder::CanBeFunctionApplyArguments(Call* expr) {
9579 ZoneList<Expression*>* args = expr->arguments(); 9579 ZoneList<Expression*>* args = expr->arguments();
9580 if (args->length() != 2) return false; 9580 if (args->length() != 2) return false;
9581 VariableProxy* arg_two = args->at(1)->AsVariableProxy(); 9581 VariableProxy* arg_two = args->at(1)->AsVariableProxy();
9582 if (arg_two == NULL || !arg_two->var()->IsStackAllocated()) return false; 9582 if (arg_two == NULL || !arg_two->var()->IsStackAllocated()) return false;
9583 HValue* arg_two_value = LookupAndMakeLive(arg_two->var()); 9583 HValue* arg_two_value = environment()->Lookup(arg_two->var());
9584 if (!arg_two_value->CheckFlag(HValue::kIsArguments)) return false; 9584 if (!arg_two_value->CheckFlag(HValue::kIsArguments)) return false;
9585 DCHECK_NOT_NULL(current_info()->scope()->arguments());
9585 return true; 9586 return true;
9586 } 9587 }
9587 9588
9588 9589
9589 void HOptimizedGraphBuilder::VisitCall(Call* expr) { 9590 void HOptimizedGraphBuilder::VisitCall(Call* expr) {
9590 DCHECK(!HasStackOverflow()); 9591 DCHECK(!HasStackOverflow());
9591 DCHECK(current_block() != NULL); 9592 DCHECK(current_block() != NULL);
9592 DCHECK(current_block()->HasPredecessor()); 9593 DCHECK(current_block()->HasPredecessor());
9593 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); 9594 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position());
9594 Expression* callee = expr->expression(); 9595 Expression* callee = expr->expression();
(...skipping 3690 matching lines...) Expand 10 before | Expand all | Expand 10 after
13285 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13286 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13286 } 13287 }
13287 13288
13288 #ifdef DEBUG 13289 #ifdef DEBUG
13289 graph_->Verify(false); // No full verify. 13290 graph_->Verify(false); // No full verify.
13290 #endif 13291 #endif
13291 } 13292 }
13292 13293
13293 } // namespace internal 13294 } // namespace internal
13294 } // namespace v8 13295 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698