| 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/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 9975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9986 // corresponding instructions and instead add HPushArguments for the | 9986 // corresponding instructions and instead add HPushArguments for the |
| 9987 // arguments in case inlining failed. What we actually should do is for | 9987 // arguments in case inlining failed. What we actually should do is for |
| 9988 // inlining to try to build a subgraph without mutating the parent graph. | 9988 // inlining to try to build a subgraph without mutating the parent graph. |
| 9989 HInstruction* instr = current_block()->last(); | 9989 HInstruction* instr = current_block()->last(); |
| 9990 do { | 9990 do { |
| 9991 HInstruction* prev_instr = instr->previous(); | 9991 HInstruction* prev_instr = instr->previous(); |
| 9992 instr->DeleteAndReplaceWith(NULL); | 9992 instr->DeleteAndReplaceWith(NULL); |
| 9993 instr = prev_instr; | 9993 instr = prev_instr; |
| 9994 } while (instr != check); | 9994 } while (instr != check); |
| 9995 environment()->SetExpressionStackAt(receiver_index, function); | 9995 environment()->SetExpressionStackAt(receiver_index, function); |
| 9996 HInstruction* call = | |
| 9997 PreProcessCall(New<HCallNew>(function, argument_count)); | |
| 9998 return ast_context()->ReturnInstruction(call, expr->id()); | |
| 9999 } else { | 9996 } else { |
| 10000 // The constructor function is both an operand to the instruction and an | 9997 // The constructor function is both an operand to the instruction and an |
| 10001 // argument to the construct call. | 9998 // argument to the construct call. |
| 10002 if (TryHandleArrayCallNew(expr, function)) return; | 9999 if (TryHandleArrayCallNew(expr, function)) return; |
| 10000 } |
| 10003 | 10001 |
| 10004 HInstruction* call = | 10002 HValue* arity = Add<HConstant>(argument_count - 1); |
| 10005 PreProcessCall(New<HCallNew>(function, argument_count)); | 10003 HValue* op_vals[] = {context(), function, function, arity}; |
| 10006 return ast_context()->ReturnInstruction(call, expr->id()); | 10004 Callable callable = CodeFactory::Construct(isolate()); |
| 10007 } | 10005 HConstant* stub = Add<HConstant>(callable.code()); |
| 10006 PushArgumentsFromEnvironment(argument_count); |
| 10007 HInstruction* construct = |
| 10008 New<HCallWithDescriptor>(stub, argument_count, callable.descriptor(), |
| 10009 Vector<HValue*>(op_vals, arraysize(op_vals))); |
| 10010 return ast_context()->ReturnInstruction(construct, expr->id()); |
| 10008 } | 10011 } |
| 10009 | 10012 |
| 10010 | 10013 |
| 10011 void HOptimizedGraphBuilder::BuildInitializeInobjectProperties( | 10014 void HOptimizedGraphBuilder::BuildInitializeInobjectProperties( |
| 10012 HValue* receiver, Handle<Map> initial_map) { | 10015 HValue* receiver, Handle<Map> initial_map) { |
| 10013 if (initial_map->GetInObjectProperties() != 0) { | 10016 if (initial_map->GetInObjectProperties() != 0) { |
| 10014 HConstant* undefined = graph()->GetConstantUndefined(); | 10017 HConstant* undefined = graph()->GetConstantUndefined(); |
| 10015 for (int i = 0; i < initial_map->GetInObjectProperties(); i++) { | 10018 for (int i = 0; i < initial_map->GetInObjectProperties(); i++) { |
| 10016 int property_offset = initial_map->GetInObjectPropertyOffset(i); | 10019 int property_offset = initial_map->GetInObjectPropertyOffset(i); |
| 10017 Add<HStoreNamedField>(receiver, HObjectAccess::ForMapAndOffset( | 10020 Add<HStoreNamedField>(receiver, HObjectAccess::ForMapAndOffset( |
| (...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13634 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13637 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13635 } | 13638 } |
| 13636 | 13639 |
| 13637 #ifdef DEBUG | 13640 #ifdef DEBUG |
| 13638 graph_->Verify(false); // No full verify. | 13641 graph_->Verify(false); // No full verify. |
| 13639 #endif | 13642 #endif |
| 13640 } | 13643 } |
| 13641 | 13644 |
| 13642 } // namespace internal | 13645 } // namespace internal |
| 13643 } // namespace v8 | 13646 } // namespace v8 |
| OLD | NEW |