Chromium Code Reviews| 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 | 6 |
| 7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/base/adapters.h" | 10 #include "src/base/adapters.h" |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1289 // Kill the Typer and thereby uninstall the decorator (if any). | 1289 // Kill the Typer and thereby uninstall the decorator (if any). |
| 1290 typer.Reset(nullptr); | 1290 typer.Reset(nullptr); |
| 1291 | 1291 |
| 1292 return ScheduleAndGenerateCode( | 1292 return ScheduleAndGenerateCode( |
| 1293 Linkage::ComputeIncoming(data.instruction_zone(), info())); | 1293 Linkage::ComputeIncoming(data.instruction_zone(), info())); |
| 1294 } | 1294 } |
| 1295 | 1295 |
| 1296 Handle<Code> Pipeline::GenerateWASMCode(CompilationInfo* info, | 1296 Handle<Code> Pipeline::GenerateWASMCode(CompilationInfo* info, |
| 1297 CallDescriptor* call_descriptor, | 1297 CallDescriptor* call_descriptor, |
| 1298 Graph* graph, | 1298 Graph* graph, |
| 1299 SourcePositionTable* source_positions) { | 1299 SourcePositionTable* source_positions, |
| 1300 Handle<Object> wasm_obj, | |
| 1301 uint32_t func_index) { | |
| 1300 // Construct a pipeline for scheduling and code generation. | 1302 // Construct a pipeline for scheduling and code generation. |
| 1301 ZonePool zone_pool(info->isolate()->allocator()); | 1303 ZonePool zone_pool(info->isolate()->allocator()); |
| 1302 PipelineData data(&zone_pool, info, graph, source_positions); | 1304 PipelineData data(&zone_pool, info, graph, source_positions); |
| 1303 base::SmartPointer<PipelineStatistics> pipeline_statistics; | 1305 base::SmartPointer<PipelineStatistics> pipeline_statistics; |
| 1304 if (FLAG_turbo_stats) { | 1306 if (FLAG_turbo_stats) { |
| 1305 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool)); | 1307 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool)); |
| 1306 pipeline_statistics->BeginPhaseKind("test codegen"); | 1308 pipeline_statistics->BeginPhaseKind("test codegen"); |
| 1307 } | 1309 } |
| 1308 | 1310 |
| 1309 Pipeline pipeline(info); | 1311 Pipeline pipeline(info); |
| 1310 pipeline.data_ = &data; | 1312 pipeline.data_ = &data; |
| 1311 if (data.schedule() == nullptr) { | 1313 if (data.schedule() == nullptr) { |
| 1312 // TODO(rossberg): Should this really be untyped? | 1314 // TODO(rossberg): Should this really be untyped? |
| 1313 pipeline.RunPrintAndVerify("Machine", true); | 1315 pipeline.RunPrintAndVerify("Machine", true); |
| 1314 } | 1316 } |
| 1315 | 1317 |
| 1316 Handle<Code> code = pipeline.ScheduleAndGenerateCode(call_descriptor); | 1318 Handle<Code> code = pipeline.ScheduleAndGenerateCode(call_descriptor); |
| 1319 | |
| 1320 Factory* factory = info->isolate()->factory(); | |
|
Michael Starzinger
2016/04/22 11:59:35
Can we move all of this into the WASM compiler?
Clemens Hammacher
2016/04/22 14:38:40
Yes we can :)
It also saves us the check whether w
titzer
2016/04/25 11:15:05
Yes, let's keep it to convey the intent, and they
| |
| 1321 Handle<FixedArray> deopt_data = factory->NewFixedArray(2, TENURED); | |
| 1322 // Generate deopt data for getting information about the executed wasm | |
| 1323 // function later. Either store wasm object and function index (default), or | |
| 1324 // just the function name (for debugging code where no wasm object is | |
| 1325 // available). | |
| 1326 if (wasm_obj.is_null()) { | |
| 1327 MaybeHandle<String> maybeName = | |
| 1328 factory->NewStringFromUtf8(info->GetFunctionName(), TENURED); | |
| 1329 if (!maybeName.is_null()) deopt_data->set(0, *maybeName.ToHandleChecked()); | |
| 1330 } else { | |
| 1331 deopt_data->set(0, *wasm_obj); | |
| 1332 deopt_data->set(1, Smi::FromInt(func_index)); | |
| 1333 } | |
| 1334 deopt_data->set_length(2); | |
| 1335 code->set_deoptimization_data(*deopt_data); | |
| 1336 | |
| 1317 return code; | 1337 return code; |
| 1318 } | 1338 } |
| 1319 | 1339 |
| 1320 Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate, | 1340 Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate, |
| 1321 CallDescriptor* call_descriptor, | 1341 CallDescriptor* call_descriptor, |
| 1322 Graph* graph, Schedule* schedule, | 1342 Graph* graph, Schedule* schedule, |
| 1323 Code::Flags flags, | 1343 Code::Flags flags, |
| 1324 const char* debug_name) { | 1344 const char* debug_name) { |
| 1325 CompilationInfo info(CStrVector(debug_name), isolate, graph->zone(), flags); | 1345 CompilationInfo info(CStrVector(debug_name), isolate, graph->zone(), flags); |
| 1326 | 1346 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1595 } | 1615 } |
| 1596 | 1616 |
| 1597 data->DeleteRegisterAllocationZone(); | 1617 data->DeleteRegisterAllocationZone(); |
| 1598 } | 1618 } |
| 1599 | 1619 |
| 1600 Isolate* Pipeline::isolate() const { return info()->isolate(); } | 1620 Isolate* Pipeline::isolate() const { return info()->isolate(); } |
| 1601 | 1621 |
| 1602 } // namespace compiler | 1622 } // namespace compiler |
| 1603 } // namespace internal | 1623 } // namespace internal |
| 1604 } // namespace v8 | 1624 } // namespace v8 |
| OLD | NEW |