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

Side by Side Diff: src/messages.cc

Issue 2161953003: Remove stack overflow boilerplate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Satisfy older mips/arm gcc versions 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') | 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 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/execution.h" 9 #include "src/execution.h"
9 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
10 #include "src/keys.h" 11 #include "src/keys.h"
11 #include "src/string-builder.h" 12 #include "src/string-builder.h"
12 #include "src/wasm/wasm-module.h" 13 #include "src/wasm/wasm-module.h"
13 14
14 namespace v8 { 15 namespace v8 {
15 namespace internal { 16 namespace internal {
16 17
17 MessageLocation::MessageLocation(Handle<Script> script, int start_pos, 18 MessageLocation::MessageLocation(Handle<Script> script, int start_pos,
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 builder.AppendString(arg); 439 builder.AppendString(arg);
439 } 440 }
440 } else { 441 } else {
441 builder.AppendCharacter(*c); 442 builder.AppendCharacter(*c);
442 } 443 }
443 } 444 }
444 445
445 return builder.Finish(); 446 return builder.Finish();
446 } 447 }
447 448
449 MaybeHandle<Object> ConstructError(Isolate* isolate, Handle<JSFunction> target,
450 Handle<Object> new_target,
451 Handle<Object> message, FrameSkipMode mode,
452 bool suppress_detailed_trace) {
453 // 1. If NewTarget is undefined, let newTarget be the active function object,
454 // else let newTarget be NewTarget.
455
456 Handle<JSReceiver> new_target_recv =
457 new_target->IsJSReceiver() ? Handle<JSReceiver>::cast(new_target)
458 : Handle<JSReceiver>::cast(target);
459
460 // 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%ErrorPrototype%",
461 // « [[ErrorData]] »).
462 Handle<JSObject> err;
463 ASSIGN_RETURN_ON_EXCEPTION(isolate, err,
464 JSObject::New(target, new_target_recv), Object);
465
466 // 3. If message is not undefined, then
467 // a. Let msg be ? ToString(message).
468 // b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]:
469 // true, [[Enumerable]]: false, [[Configurable]]: true}.
470 // c. Perform ! DefinePropertyOrThrow(O, "message", msgDesc).
471 // 4. Return O.
472
473 if (!message->IsUndefined(isolate)) {
474 Handle<String> msg_string;
475 ASSIGN_RETURN_ON_EXCEPTION(isolate, msg_string,
476 Object::ToString(isolate, message), Object);
477 RETURN_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes(
478 err, isolate->factory()->message_string(),
479 msg_string, DONT_ENUM),
480 Object);
481 }
482
483 // Optionally capture a more detailed stack trace for the message.
484 if (!suppress_detailed_trace) {
485 RETURN_ON_EXCEPTION(isolate, isolate->CaptureAndSetDetailedStackTrace(err),
486 Object);
487 }
488 // Capture a simple stack trace for the stack property.
489 RETURN_ON_EXCEPTION(isolate, isolate->CaptureAndSetSimpleStackTrace(
490 err, mode, Handle<Object>()),
491 Object);
492
493 return err;
494 }
448 495
449 } // namespace internal 496 } // namespace internal
450 } // namespace v8 497 } // namespace v8
OLDNEW
« no previous file with comments | « src/messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698