| OLD | NEW |
| 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 | 10 |
| (...skipping 11292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11303 return ast_context()->ReturnValue(value); | 11303 return ast_context()->ReturnValue(value); |
| 11304 } else { | 11304 } else { |
| 11305 return ast_context()->ReturnControl(New<HIsConstructCallAndBranch>(), | 11305 return ast_context()->ReturnControl(New<HIsConstructCallAndBranch>(), |
| 11306 call->id()); | 11306 call->id()); |
| 11307 } | 11307 } |
| 11308 } | 11308 } |
| 11309 | 11309 |
| 11310 | 11310 |
| 11311 // Support for arguments.length and arguments[?]. | 11311 // Support for arguments.length and arguments[?]. |
| 11312 void HOptimizedGraphBuilder::GenerateArgumentsLength(CallRuntime* call) { | 11312 void HOptimizedGraphBuilder::GenerateArgumentsLength(CallRuntime* call) { |
| 11313 // Our implementation of arguments (based on this stack frame or an | |
| 11314 // adapter below it) does not work for inlined functions. This runtime | |
| 11315 // function is blacklisted by AstNode::IsInlineable. | |
| 11316 ASSERT(function_state()->outer() == NULL); | |
| 11317 ASSERT(call->arguments()->length() == 0); | 11313 ASSERT(call->arguments()->length() == 0); |
| 11318 HInstruction* elements = Add<HArgumentsElements>(false); | 11314 HInstruction* result = NULL; |
| 11319 HArgumentsLength* result = New<HArgumentsLength>(elements); | 11315 if (function_state()->outer() == NULL) { |
| 11316 HInstruction* elements = Add<HArgumentsElements>(false); |
| 11317 result = New<HArgumentsLength>(elements); |
| 11318 } else { |
| 11319 // Number of arguments without receiver. |
| 11320 int argument_count = environment()-> |
| 11321 arguments_environment()->parameter_count() - 1; |
| 11322 result = New<HConstant>(argument_count); |
| 11323 } |
| 11320 return ast_context()->ReturnInstruction(result, call->id()); | 11324 return ast_context()->ReturnInstruction(result, call->id()); |
| 11321 } | 11325 } |
| 11322 | 11326 |
| 11323 | 11327 |
| 11324 void HOptimizedGraphBuilder::GenerateArguments(CallRuntime* call) { | 11328 void HOptimizedGraphBuilder::GenerateArguments(CallRuntime* call) { |
| 11325 // Our implementation of arguments (based on this stack frame or an | 11329 // Our implementation of arguments (based on this stack frame or an |
| 11326 // adapter below it) does not work for inlined functions. This runtime | 11330 // adapter below it) does not work for inlined functions. This runtime |
| 11327 // function is blacklisted by AstNode::IsInlineable. | 11331 // function is blacklisted by AstNode::IsInlineable. |
| 11328 ASSERT(function_state()->outer() == NULL); | 11332 ASSERT(function_state()->outer() == NULL); |
| 11329 ASSERT(call->arguments()->length() == 1); | 11333 ASSERT(call->arguments()->length() == 1); |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12352 if (ShouldProduceTraceOutput()) { | 12356 if (ShouldProduceTraceOutput()) { |
| 12353 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12357 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12354 } | 12358 } |
| 12355 | 12359 |
| 12356 #ifdef DEBUG | 12360 #ifdef DEBUG |
| 12357 graph_->Verify(false); // No full verify. | 12361 graph_->Verify(false); // No full verify. |
| 12358 #endif | 12362 #endif |
| 12359 } | 12363 } |
| 12360 | 12364 |
| 12361 } } // namespace v8::internal | 12365 } } // namespace v8::internal |
| OLD | NEW |