Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/objects.cc

Issue 2147193002: Don't call into JS from within stack trace generation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Just access the script itself, it's what the accessors do Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/js/messages.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sstream> 9 #include <sstream>
10 10
(...skipping 12804 matching lines...) Expand 10 before | Expand all | Expand 10 after
12815 for (int pos = 0; pos < len; pos++) { 12815 for (int pos = 0; pos < len; pos++) {
12816 if (pos == code_pos) break; 12816 if (pos == code_pos) break;
12817 if (source_string->Get(pos) == '\n') line++; 12817 if (source_string->Get(pos) == '\n') line++;
12818 } 12818 }
12819 return line; 12819 return line;
12820 } 12820 }
12821 12821
12822 12822
12823 Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) { 12823 Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) {
12824 Isolate* isolate = script->GetIsolate(); 12824 Isolate* isolate = script->GetIsolate();
12825 Handle<String> name_or_source_url_key = 12825
12826 isolate->factory()->InternalizeOneByteString( 12826 // Keep in sync with ScriptNameOrSourceURL in messages.js.
12827 STATIC_CHAR_VECTOR("nameOrSourceURL")); 12827
12828 Handle<JSObject> script_wrapper = Script::GetWrapper(script); 12828 if (!script->source_url()->IsUndefined(isolate)) {
12829 Handle<Object> property = 12829 return handle(script->source_url(), isolate);
12830 JSReceiver::GetProperty(script_wrapper, name_or_source_url_key)
12831 .ToHandleChecked();
12832 DCHECK(property->IsJSFunction());
12833 Handle<Object> result;
12834 // Do not check against pending exception, since this function may be called
12835 // when an exception has already been pending.
12836 if (!Execution::TryCall(isolate, property, script_wrapper, 0, NULL)
12837 .ToHandle(&result)) {
12838 return isolate->factory()->undefined_value();
12839 } 12830 }
12840 return result; 12831 return handle(script->name(), isolate);
12841 } 12832 }
12842 12833
12843 12834
12844 Handle<JSObject> Script::GetWrapper(Handle<Script> script) { 12835 Handle<JSObject> Script::GetWrapper(Handle<Script> script) {
12845 Isolate* isolate = script->GetIsolate(); 12836 Isolate* isolate = script->GetIsolate();
12846 if (!script->wrapper()->IsUndefined(isolate)) { 12837 if (!script->wrapper()->IsUndefined(isolate)) {
12847 DCHECK(script->wrapper()->IsWeakCell()); 12838 DCHECK(script->wrapper()->IsWeakCell());
12848 Handle<WeakCell> cell(WeakCell::cast(script->wrapper())); 12839 Handle<WeakCell> cell(WeakCell::cast(script->wrapper()));
12849 if (!cell->cleared()) { 12840 if (!cell->cleared()) {
12850 // Return a handle for the existing script wrapper from the cache. 12841 // Return a handle for the existing script wrapper from the cache.
(...skipping 6084 matching lines...) Expand 10 before | Expand all | Expand 10 after
18935 18926
18936 Object* data_obj = 18927 Object* data_obj =
18937 constructor->shared()->get_api_func_data()->access_check_info(); 18928 constructor->shared()->get_api_func_data()->access_check_info();
18938 if (data_obj->IsUndefined(isolate)) return nullptr; 18929 if (data_obj->IsUndefined(isolate)) return nullptr;
18939 18930
18940 return AccessCheckInfo::cast(data_obj); 18931 return AccessCheckInfo::cast(data_obj);
18941 } 18932 }
18942 18933
18943 } // namespace internal 18934 } // namespace internal
18944 } // namespace v8 18935 } // namespace v8
OLDNEW
« no previous file with comments | « src/js/messages.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698