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

Side by Side Diff: src/messages.cc

Issue 2164903004: Eagerly format traces in captureStackTrace (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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/messages.h ('k') | test/mjsunit/stack-traces.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/messages.h" 5 #include "src/messages.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/execution.h" 9 #include "src/execution.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // receiver. 357 // receiver.
358 Object* ctor_symbol = isolate_->heap()->call_site_constructor_symbol(); 358 Object* ctor_symbol = isolate_->heap()->call_site_constructor_symbol();
359 if (*receiver_ == ctor_symbol) return true; 359 if (*receiver_ == ctor_symbol) return true;
360 if (!IsJavaScript() || !receiver_->IsJSObject()) return false; 360 if (!IsJavaScript() || !receiver_->IsJSObject()) return false;
361 Handle<Object> constructor = 361 Handle<Object> constructor =
362 JSReceiver::GetDataProperty(Handle<JSObject>::cast(receiver_), 362 JSReceiver::GetDataProperty(Handle<JSObject>::cast(receiver_),
363 isolate_->factory()->constructor_string()); 363 isolate_->factory()->constructor_string());
364 return constructor.is_identical_to(fun_); 364 return constructor.is_identical_to(fun_);
365 } 365 }
366 366
367 MaybeHandle<Object> FormatStackTrace(Isolate* isolate, Handle<JSObject> error,
368 Handle<Object> stack_trace) {
369 // TODO(jgruber): Port FormatStackTrace from JS.
370 Handle<JSFunction> fun = isolate->error_format_stack_trace();
371
372 int argc = 2;
373 ScopedVector<Handle<Object>> argv(argc);
374 argv[0] = error;
375 argv[1] = stack_trace;
376
377 Handle<Object> formatted_stack_trace;
378 ASSIGN_RETURN_ON_EXCEPTION(
379 isolate, formatted_stack_trace,
380 Execution::Call(isolate, fun, error, argc, argv.start()), Object);
381
382 return formatted_stack_trace;
383 }
367 384
368 Handle<String> MessageTemplate::FormatMessage(Isolate* isolate, 385 Handle<String> MessageTemplate::FormatMessage(Isolate* isolate,
369 int template_index, 386 int template_index,
370 Handle<Object> arg) { 387 Handle<Object> arg) {
371 Factory* factory = isolate->factory(); 388 Factory* factory = isolate->factory();
372 Handle<String> result_string; 389 Handle<String> result_string;
373 if (arg->IsString()) { 390 if (arg->IsString()) {
374 result_string = Handle<String>::cast(arg); 391 result_string = Handle<String>::cast(arg);
375 } else { 392 } else {
376 Handle<JSFunction> fun = isolate->no_side_effects_to_string_fun(); 393 Handle<JSFunction> fun = isolate->no_side_effects_to_string_fun();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // Capture a simple stack trace for the stack property. 505 // Capture a simple stack trace for the stack property.
489 RETURN_ON_EXCEPTION(isolate, isolate->CaptureAndSetSimpleStackTrace( 506 RETURN_ON_EXCEPTION(isolate, isolate->CaptureAndSetSimpleStackTrace(
490 err, mode, Handle<Object>()), 507 err, mode, Handle<Object>()),
491 Object); 508 Object);
492 509
493 return err; 510 return err;
494 } 511 }
495 512
496 } // namespace internal 513 } // namespace internal
497 } // namespace v8 514 } // namespace v8
OLDNEW
« no previous file with comments | « src/messages.h ('k') | test/mjsunit/stack-traces.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698