Index: src/compiler/pipeline.cc |
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
index 3c44a99990e848b908f1f6ba02784984046e9d9c..d9ee0ab56173f573cca248298eb4d670f3b814c6 100644 |
--- a/src/compiler/pipeline.cc |
+++ b/src/compiler/pipeline.cc |
@@ -1296,7 +1296,9 @@ Handle<Code> Pipeline::GenerateCode() { |
Handle<Code> Pipeline::GenerateWASMCode(CompilationInfo* info, |
CallDescriptor* call_descriptor, |
Graph* graph, |
- SourcePositionTable* source_positions) { |
+ SourcePositionTable* source_positions, |
+ Handle<Object> wasm_obj, |
+ uint32_t func_index) { |
// Construct a pipeline for scheduling and code generation. |
ZonePool zone_pool(info->isolate()->allocator()); |
PipelineData data(&zone_pool, info, graph, source_positions); |
@@ -1314,6 +1316,24 @@ Handle<Code> Pipeline::GenerateWASMCode(CompilationInfo* info, |
} |
Handle<Code> code = pipeline.ScheduleAndGenerateCode(call_descriptor); |
+ |
+ 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
|
+ Handle<FixedArray> deopt_data = factory->NewFixedArray(2, TENURED); |
+ // Generate deopt data for getting information about the executed wasm |
+ // function later. Either store wasm object and function index (default), or |
+ // just the function name (for debugging code where no wasm object is |
+ // available). |
+ if (wasm_obj.is_null()) { |
+ MaybeHandle<String> maybeName = |
+ factory->NewStringFromUtf8(info->GetFunctionName(), TENURED); |
+ if (!maybeName.is_null()) deopt_data->set(0, *maybeName.ToHandleChecked()); |
+ } else { |
+ deopt_data->set(0, *wasm_obj); |
+ deopt_data->set(1, Smi::FromInt(func_index)); |
+ } |
+ deopt_data->set_length(2); |
+ code->set_deoptimization_data(*deopt_data); |
+ |
return code; |
} |