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 13055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13066 } | 13066 } |
13067 | 13067 |
13068 bool Script::GetPositionInfo(Handle<Script> script, int position, | 13068 bool Script::GetPositionInfo(Handle<Script> script, int position, |
13069 PositionInfo* info, OffsetFlag offset_flag) { | 13069 PositionInfo* info, OffsetFlag offset_flag) { |
13070 // For wasm, we do not create an artificial line_ends array, but do the | 13070 // For wasm, we do not create an artificial line_ends array, but do the |
13071 // translation directly. | 13071 // translation directly. |
13072 if (script->type() != Script::TYPE_WASM) InitLineEnds(script); | 13072 if (script->type() != Script::TYPE_WASM) InitLineEnds(script); |
13073 return script->GetPositionInfo(position, info, offset_flag); | 13073 return script->GetPositionInfo(position, info, offset_flag); |
13074 } | 13074 } |
13075 | 13075 |
| 13076 bool Script::IsUserJavaScript() { return type() == Script::TYPE_NORMAL; } |
| 13077 |
13076 namespace { | 13078 namespace { |
13077 bool GetPositionInfoSlow(const Script* script, int position, | 13079 bool GetPositionInfoSlow(const Script* script, int position, |
13078 Script::PositionInfo* info) { | 13080 Script::PositionInfo* info) { |
13079 if (!script->source()->IsString()) return false; | 13081 if (!script->source()->IsString()) return false; |
13080 if (position < 0) position = 0; | 13082 if (position < 0) position = 0; |
13081 | 13083 |
13082 String* source_string = String::cast(script->source()); | 13084 String* source_string = String::cast(script->source()); |
13083 int line = 0; | 13085 int line = 0; |
13084 int line_start = 0; | 13086 int line_start = 0; |
13085 int len = source_string->length(); | 13087 int len = source_string->length(); |
(...skipping 7175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20261 // depend on this. | 20263 // depend on this. |
20262 return DICTIONARY_ELEMENTS; | 20264 return DICTIONARY_ELEMENTS; |
20263 } | 20265 } |
20264 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20266 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20265 return kind; | 20267 return kind; |
20266 } | 20268 } |
20267 } | 20269 } |
20268 | 20270 |
20269 } // namespace internal | 20271 } // namespace internal |
20270 } // namespace v8 | 20272 } // namespace v8 |
OLD | NEW |