OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
6 | 6 |
7 (function(global, utils) { | 7 (function(global, utils) { |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 var Int16x8ToString; | 30 var Int16x8ToString; |
31 var Int32x4ToString; | 31 var Int32x4ToString; |
32 var Int8x16ToString; | 32 var Int8x16ToString; |
33 var InternalArray = utils.InternalArray; | 33 var InternalArray = utils.InternalArray; |
34 var internalErrorSymbol = utils.ImportNow("internal_error_symbol"); | 34 var internalErrorSymbol = utils.ImportNow("internal_error_symbol"); |
35 var ObjectDefineProperty; | 35 var ObjectDefineProperty; |
36 var ObjectHasOwnProperty; | 36 var ObjectHasOwnProperty; |
37 var ObjectToString = utils.ImportNow("object_to_string"); | 37 var ObjectToString = utils.ImportNow("object_to_string"); |
38 var Script = utils.ImportNow("Script"); | 38 var Script = utils.ImportNow("Script"); |
39 var stackTraceSymbol = utils.ImportNow("stack_trace_symbol"); | 39 var stackTraceSymbol = utils.ImportNow("stack_trace_symbol"); |
| 40 var StringCharAt; |
40 var StringIndexOf; | 41 var StringIndexOf; |
41 var StringSubstring; | 42 var StringSubstring; |
42 var SymbolToString; | 43 var SymbolToString; |
43 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 44 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
44 var Uint16x8ToString; | 45 var Uint16x8ToString; |
45 var Uint32x4ToString; | 46 var Uint32x4ToString; |
46 var Uint8x16ToString; | 47 var Uint8x16ToString; |
47 | 48 |
48 utils.Import(function(from) { | 49 utils.Import(function(from) { |
49 ArrayJoin = from.ArrayJoin; | 50 ArrayJoin = from.ArrayJoin; |
50 Bool16x8ToString = from.Bool16x8ToString; | 51 Bool16x8ToString = from.Bool16x8ToString; |
51 Bool32x4ToString = from.Bool32x4ToString; | 52 Bool32x4ToString = from.Bool32x4ToString; |
52 Bool8x16ToString = from.Bool8x16ToString; | 53 Bool8x16ToString = from.Bool8x16ToString; |
53 Float32x4ToString = from.Float32x4ToString; | 54 Float32x4ToString = from.Float32x4ToString; |
54 Int16x8ToString = from.Int16x8ToString; | 55 Int16x8ToString = from.Int16x8ToString; |
55 Int32x4ToString = from.Int32x4ToString; | 56 Int32x4ToString = from.Int32x4ToString; |
56 Int8x16ToString = from.Int8x16ToString; | 57 Int8x16ToString = from.Int8x16ToString; |
57 ObjectDefineProperty = from.ObjectDefineProperty; | 58 ObjectDefineProperty = from.ObjectDefineProperty; |
58 ObjectHasOwnProperty = from.ObjectHasOwnProperty; | 59 ObjectHasOwnProperty = from.ObjectHasOwnProperty; |
| 60 StringCharAt = from.StringCharAt; |
59 StringIndexOf = from.StringIndexOf; | 61 StringIndexOf = from.StringIndexOf; |
60 StringSubstring = from.StringSubstring; | 62 StringSubstring = from.StringSubstring; |
61 SymbolToString = from.SymbolToString; | 63 SymbolToString = from.SymbolToString; |
62 Uint16x8ToString = from.Uint16x8ToString; | 64 Uint16x8ToString = from.Uint16x8ToString; |
63 Uint32x4ToString = from.Uint32x4ToString; | 65 Uint32x4ToString = from.Uint32x4ToString; |
64 Uint8x16ToString = from.Uint8x16ToString; | 66 Uint8x16ToString = from.Uint8x16ToString; |
65 }); | 67 }); |
66 | 68 |
67 // ------------------------------------------------------------------- | 69 // ------------------------------------------------------------------- |
68 | 70 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } else if (position <= line_ends[i - 1]) { | 248 } else if (position <= line_ends[i - 1]) { |
247 upper = i - 1; | 249 upper = i - 1; |
248 } else { | 250 } else { |
249 return i; | 251 return i; |
250 } | 252 } |
251 } | 253 } |
252 | 254 |
253 return -1; | 255 return -1; |
254 } | 256 } |
255 | 257 |
256 | |
257 /** | 258 /** |
258 * Get information on a specific source position. | 259 * Get information on a specific source position. |
259 * @param {number} position The source position | 260 * @param {number} position The source position |
260 * @param {boolean} include_resource_offset Set to true to have the resource | 261 * @param {boolean} include_resource_offset Set to true to have the resource |
261 * offset added to the location | 262 * offset added to the location |
262 * @return {SourceLocation} | 263 * @return {SourceLocation} |
263 * If line is negative or not in the source null is returned. | 264 * If line is negative or not in the source null is returned. |
264 */ | 265 */ |
265 function ScriptLocationFromPosition(position, | 266 function ScriptLocationFromPosition(position, |
266 include_resource_offset) { | 267 include_resource_offset) { |
267 var line = this.lineFromPosition(position); | 268 var line = this.lineFromPosition(position); |
268 if (line == -1) return null; | 269 if (line == -1) return null; |
269 | 270 |
270 // Determine start, end and column. | 271 // Determine start, end and column. |
271 var line_ends = this.line_ends; | 272 var line_ends = this.line_ends; |
272 var start = line == 0 ? 0 : line_ends[line - 1] + 1; | 273 var start = line == 0 ? 0 : line_ends[line - 1] + 1; |
273 var end = line_ends[line]; | 274 var end = line_ends[line]; |
274 if (end > 0 && %_StringCharAt(this.source, end - 1) === '\r') { | 275 if (end > 0 && %_Call(StringCharAt, this.source, end - 1) == '\r') { |
275 end--; | 276 end--; |
276 } | 277 } |
277 var column = position - start; | 278 var column = position - start; |
278 | 279 |
279 // Adjust according to the offset within the resource. | 280 // Adjust according to the offset within the resource. |
280 if (include_resource_offset) { | 281 if (include_resource_offset) { |
281 line += this.line_offset; | 282 line += this.line_offset; |
282 if (line == this.line_offset) { | 283 if (line == this.line_offset) { |
283 column += this.column_offset; | 284 column += this.column_offset; |
284 } | 285 } |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 utils.Export(function(to) { | 1018 utils.Export(function(to) { |
1018 to.ErrorToString = ErrorToString; | 1019 to.ErrorToString = ErrorToString; |
1019 to.MakeError = MakeError; | 1020 to.MakeError = MakeError; |
1020 to.MakeRangeError = MakeRangeError; | 1021 to.MakeRangeError = MakeRangeError; |
1021 to.MakeSyntaxError = MakeSyntaxError; | 1022 to.MakeSyntaxError = MakeSyntaxError; |
1022 to.MakeTypeError = MakeTypeError; | 1023 to.MakeTypeError = MakeTypeError; |
1023 to.MakeURIError = MakeURIError; | 1024 to.MakeURIError = MakeURIError; |
1024 }); | 1025 }); |
1025 | 1026 |
1026 }); | 1027 }); |
OLD | NEW |