OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 13403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13414 Handle<FixedArray> array = String::CalculateLineEnds(src, true); | 13414 Handle<FixedArray> array = String::CalculateLineEnds(src, true); |
13415 script->set_line_ends(*array); | 13415 script->set_line_ends(*array); |
13416 } | 13416 } |
13417 | 13417 |
13418 DCHECK(script->line_ends()->IsFixedArray()); | 13418 DCHECK(script->line_ends()->IsFixedArray()); |
13419 } | 13419 } |
13420 | 13420 |
13421 #define SMI_VALUE(x) (Smi::cast(x)->value()) | 13421 #define SMI_VALUE(x) (Smi::cast(x)->value()) |
13422 bool Script::GetPositionInfo(int position, PositionInfo* info, | 13422 bool Script::GetPositionInfo(int position, PositionInfo* info, |
13423 OffsetFlag offset_flag) { | 13423 OffsetFlag offset_flag) { |
13424 // For wasm, we do not create an artificial line_ends array, but do the | |
13425 // translation directly. | |
13426 if (type() == Script::TYPE_WASM) { | |
Yang
2016/11/15 07:42:25
InitLineEnds is called from a number of places, wh
Clemens Hammacher
2016/11/15 15:04:06
I would like to keep wasm's function offset table
| |
13427 Handle<wasm::WasmCompiledModule> compiled_module( | |
13428 wasm::WasmCompiledModule::cast(wasm_compiled_module())); | |
13429 DCHECK_LE(0, position); | |
13430 return wasm::GetPositionInfo(compiled_module, | |
13431 static_cast<uint32_t>(position), info); | |
13432 } | |
13433 | |
13424 Handle<Script> script(this); | 13434 Handle<Script> script(this); |
13425 InitLineEnds(script); | 13435 InitLineEnds(script); |
13426 | 13436 |
13427 DisallowHeapAllocation no_allocation; | 13437 DisallowHeapAllocation no_allocation; |
13428 | 13438 |
13429 DCHECK(script->line_ends()->IsFixedArray()); | 13439 DCHECK(script->line_ends()->IsFixedArray()); |
13430 FixedArray* ends = FixedArray::cast(script->line_ends()); | 13440 FixedArray* ends = FixedArray::cast(script->line_ends()); |
13431 | 13441 |
13432 const int ends_len = ends->length(); | 13442 const int ends_len = ends->length(); |
13433 if (ends_len == 0) return false; | 13443 if (ends_len == 0) return false; |
(...skipping 6906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20340 // Check if the accessor uses a cached property. | 20350 // Check if the accessor uses a cached property. |
20341 if (!fti->cached_property_name()->IsTheHole(isolate)) { | 20351 if (!fti->cached_property_name()->IsTheHole(isolate)) { |
20342 return handle(Name::cast(fti->cached_property_name())); | 20352 return handle(Name::cast(fti->cached_property_name())); |
20343 } | 20353 } |
20344 } | 20354 } |
20345 return MaybeHandle<Name>(); | 20355 return MaybeHandle<Name>(); |
20346 } | 20356 } |
20347 | 20357 |
20348 } // namespace internal | 20358 } // namespace internal |
20349 } // namespace v8 | 20359 } // namespace v8 |
OLD | NEW |