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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 * @return {?string} script name if present, value for //# sourceURL comment or | 53 * @return {?string} script name if present, value for //# sourceURL comment or |
54 * deprecated //@ sourceURL comment otherwise. | 54 * deprecated //@ sourceURL comment otherwise. |
55 */ | 55 */ |
56 function ScriptNameOrSourceURL() { | 56 function ScriptNameOrSourceURL() { |
57 // Keep in sync with Script::GetNameOrSourceURL. | 57 // Keep in sync with Script::GetNameOrSourceURL. |
58 if (this.source_url) return this.source_url; | 58 if (this.source_url) return this.source_url; |
59 return this.name; | 59 return this.name; |
60 } | 60 } |
61 | 61 |
62 | 62 |
| 63 /** |
| 64 * Check whether the script is a WebAssembly (wasm) script. |
| 65 * |
| 66 * @return {boolean} true if this is a wasm script |
| 67 */ |
| 68 function ScriptIsWasm() { |
| 69 let kWasmScriptType = 3; |
| 70 return this.type == kWasmScriptType; |
| 71 } |
| 72 |
| 73 |
63 utils.SetUpLockedPrototype(Script, [ | 74 utils.SetUpLockedPrototype(Script, [ |
64 "source", | 75 "source", |
65 "name", | 76 "name", |
66 "source_url", | 77 "source_url", |
67 "source_mapping_url", | 78 "source_mapping_url", |
68 "line_offset", | 79 "line_offset", |
69 "column_offset" | 80 "column_offset" |
70 ], [ | 81 ], [ |
71 "locationFromPosition", ScriptLocationFromPosition, | 82 "locationFromPosition", ScriptLocationFromPosition, |
72 "nameOrSourceURL", ScriptNameOrSourceURL, | 83 "nameOrSourceURL", ScriptNameOrSourceURL, |
| 84 "isWasm", ScriptIsWasm, |
73 ] | 85 ] |
74 ); | 86 ); |
75 | 87 |
76 }); | 88 }); |
OLD | NEW |