| OLD | NEW | 
|    1 // Copyright 2014 the V8 project authors. All rights reserved. |    1 // Copyright 2014 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/compiler/pipeline.h" |    5 #include "src/compiler/pipeline.h" | 
|    6 #include "src/compiler/raw-machine-assembler.h" |    6 #include "src/compiler/raw-machine-assembler.h" | 
|    7 #include "src/compiler/scheduler.h" |    7 #include "src/compiler/scheduler.h" | 
|    8  |    8  | 
|    9 namespace v8 { |    9 namespace v8 { | 
|   10 namespace internal { |   10 namespace internal { | 
|   11 namespace compiler { |   11 namespace compiler { | 
|   12  |   12  | 
|   13 RawMachineAssembler::RawMachineAssembler( |   13 RawMachineAssembler::RawMachineAssembler(Graph* graph, | 
|   14     Graph* graph, MachineCallDescriptorBuilder* call_descriptor_builder, |   14                                          MachineSignature* machine_sig, | 
|   15     MachineType word) |   15                                          MachineType word) | 
|   16     : GraphBuilder(graph), |   16     : GraphBuilder(graph), | 
|   17       schedule_(new (zone()) Schedule(zone())), |   17       schedule_(new (zone()) Schedule(zone())), | 
|   18       machine_(zone(), word), |   18       machine_(zone(), word), | 
|   19       common_(zone()), |   19       common_(zone()), | 
|   20       call_descriptor_builder_(call_descriptor_builder), |   20       machine_sig_(machine_sig), | 
 |   21       call_descriptor_( | 
 |   22           Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)), | 
|   21       parameters_(NULL), |   23       parameters_(NULL), | 
|   22       exit_label_(schedule()->end()), |   24       exit_label_(schedule()->end()), | 
|   23       current_block_(schedule()->start()) { |   25       current_block_(schedule()->start()) { | 
|   24   Node* s = graph->NewNode(common_.Start(parameter_count())); |   26   Node* s = graph->NewNode(common_.Start(parameter_count())); | 
|   25   graph->SetStart(s); |   27   graph->SetStart(s); | 
|   26   if (parameter_count() == 0) return; |   28   if (parameter_count() == 0) return; | 
|   27   parameters_ = zone()->NewArray<Node*>(parameter_count()); |   29   parameters_ = zone()->NewArray<Node*>(parameter_count()); | 
|   28   for (int i = 0; i < parameter_count(); ++i) { |   30   for (int i = 0; i < parameter_count(); ++i) { | 
|   29     parameters_[i] = NewNode(common()->Parameter(i), graph->start()); |   31     parameters_[i] = NewNode(common()->Parameter(i), graph->start()); | 
|   30   } |   32   } | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   88       d, 1, CallDescriptor::kNeedsFrameState, zone()); |   90       d, 1, CallDescriptor::kNeedsFrameState, zone()); | 
|   89   Node* stub_code = HeapConstant(stub.GetCode()); |   91   Node* stub_code = HeapConstant(stub.GetCode()); | 
|   90   Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, |   92   Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, | 
|   91                                 receiver, context, frame_state); |   93                                 receiver, context, frame_state); | 
|   92   schedule()->AddNode(CurrentBlock(), call); |   94   schedule()->AddNode(CurrentBlock(), call); | 
|   93   return call; |   95   return call; | 
|   94 } |   96 } | 
|   95  |   97  | 
|   96  |   98  | 
|   97 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver, |   99 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver, | 
|   98                                    Node* frame_state) { |  100                                    Node* context, Node* frame_state) { | 
|   99   CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(1, zone()); |  101   CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(1, zone()); | 
|  100   Node* call = graph()->NewNode(common()->Call(descriptor), function, receiver, |  102   Node* call = graph()->NewNode(common()->Call(descriptor), function, receiver, | 
|  101                                 frame_state); |  103                                 context, frame_state); | 
|  102   schedule()->AddNode(CurrentBlock(), call); |  104   schedule()->AddNode(CurrentBlock(), call); | 
|  103   return call; |  105   return call; | 
|  104 } |  106 } | 
|  105  |  107  | 
|  106  |  108  | 
|  107 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, |  109 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, | 
|  108                                         Node* arg0, Node* frame_state) { |  110                                         Node* arg0, Node* context, | 
 |  111                                         Node* frame_state) { | 
|  109   CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( |  112   CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | 
|  110       function, 1, Operator::kNoProperties, CallDescriptor::kNeedsFrameState, |  113       function, 1, Operator::kNoProperties, CallDescriptor::kNeedsFrameState, | 
|  111       zone()); |  114       zone()); | 
|  112  |  115  | 
|  113   Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); |  116   Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); | 
|  114   Node* ref = NewNode( |  117   Node* ref = NewNode( | 
|  115       common()->ExternalConstant(ExternalReference(function, isolate()))); |  118       common()->ExternalConstant(ExternalReference(function, isolate()))); | 
|  116   Node* arity = Int32Constant(1); |  119   Node* arity = Int32Constant(1); | 
|  117   Node* context = Parameter(1); |  | 
|  118  |  120  | 
|  119   Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref, |  121   Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref, | 
|  120                                 arity, context, frame_state); |  122                                 arity, context, frame_state); | 
|  121   schedule()->AddNode(CurrentBlock(), call); |  123   schedule()->AddNode(CurrentBlock(), call); | 
|  122   return call; |  124   return call; | 
|  123 } |  125 } | 
|  124  |  126  | 
|  125  |  127  | 
|  126 void RawMachineAssembler::Bind(Label* label) { |  128 void RawMachineAssembler::Bind(Label* label) { | 
|  127   DCHECK(current_block_ == NULL); |  129   DCHECK(current_block_ == NULL); | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|  156   Node* node = graph()->NewNode(op, input_count, inputs); |  158   Node* node = graph()->NewNode(op, input_count, inputs); | 
|  157   BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() |  159   BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() | 
|  158                                                            : CurrentBlock(); |  160                                                            : CurrentBlock(); | 
|  159   schedule()->AddNode(block, node); |  161   schedule()->AddNode(block, node); | 
|  160   return node; |  162   return node; | 
|  161 } |  163 } | 
|  162  |  164  | 
|  163 }  // namespace compiler |  165 }  // namespace compiler | 
|  164 }  // namespace internal |  166 }  // namespace internal | 
|  165 }  // namespace v8 |  167 }  // namespace v8 | 
| OLD | NEW |