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 13587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13598 GetPositionInfo(script, code_pos, &info, WITH_OFFSET); | 13598 GetPositionInfo(script, code_pos, &info, WITH_OFFSET); |
13599 return info.line; | 13599 return info.line; |
13600 } | 13600 } |
13601 | 13601 |
13602 int Script::GetLineNumber(int code_pos) const { | 13602 int Script::GetLineNumber(int code_pos) const { |
13603 PositionInfo info; | 13603 PositionInfo info; |
13604 GetPositionInfo(code_pos, &info, WITH_OFFSET); | 13604 GetPositionInfo(code_pos, &info, WITH_OFFSET); |
13605 return info.line; | 13605 return info.line; |
13606 } | 13606 } |
13607 | 13607 |
13608 Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) { | 13608 Object* Script::GetNameOrSourceURL() { |
13609 Isolate* isolate = script->GetIsolate(); | 13609 Isolate* isolate = GetIsolate(); |
13610 | |
13611 // Keep in sync with ScriptNameOrSourceURL in messages.js. | 13610 // Keep in sync with ScriptNameOrSourceURL in messages.js. |
13612 | 13611 if (!source_url()->IsUndefined(isolate)) return source_url(); |
13613 if (!script->source_url()->IsUndefined(isolate)) { | 13612 return name(); |
13614 return handle(script->source_url(), isolate); | |
13615 } | |
13616 return handle(script->name(), isolate); | |
13617 } | 13613 } |
13618 | 13614 |
13619 | 13615 |
13620 Handle<JSObject> Script::GetWrapper(Handle<Script> script) { | 13616 Handle<JSObject> Script::GetWrapper(Handle<Script> script) { |
13621 Isolate* isolate = script->GetIsolate(); | 13617 Isolate* isolate = script->GetIsolate(); |
13622 if (!script->wrapper()->IsUndefined(isolate)) { | 13618 if (!script->wrapper()->IsUndefined(isolate)) { |
13623 DCHECK(script->wrapper()->IsWeakCell()); | 13619 DCHECK(script->wrapper()->IsWeakCell()); |
13624 Handle<WeakCell> cell(WeakCell::cast(script->wrapper())); | 13620 Handle<WeakCell> cell(WeakCell::cast(script->wrapper())); |
13625 if (!cell->cleared()) { | 13621 if (!cell->cleared()) { |
13626 // Return a handle for the existing script wrapper from the cache. | 13622 // Return a handle for the existing script wrapper from the cache. |
(...skipping 6811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20438 // depend on this. | 20434 // depend on this. |
20439 return DICTIONARY_ELEMENTS; | 20435 return DICTIONARY_ELEMENTS; |
20440 } | 20436 } |
20441 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20437 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20442 return kind; | 20438 return kind; |
20443 } | 20439 } |
20444 } | 20440 } |
20445 | 20441 |
20446 } // namespace internal | 20442 } // namespace internal |
20447 } // namespace v8 | 20443 } // namespace v8 |
OLD | NEW |