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

Side by Side Diff: src/builtins/builtins-error.cc

Issue 2206203002: Move FormatStackTrace to ErrorUtils (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@port-no-sideeffect-to-string
Patch Set: Rebase Created 4 years, 4 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/accessors.cc ('k') | src/messages.h » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins/builtins.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 #include "src/messages.h" 8 #include "src/messages.h"
9 #include "src/property-descriptor.h" 9 #include "src/property-descriptor.h"
10 #include "src/string-builder.h" 10 #include "src/string-builder.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 // Eagerly format the stack trace and set the stack property. 54 // Eagerly format the stack trace and set the stack property.
55 55
56 Handle<Object> stack_trace = 56 Handle<Object> stack_trace =
57 isolate->CaptureSimpleStackTrace(object, mode, caller); 57 isolate->CaptureSimpleStackTrace(object, mode, caller);
58 if (!stack_trace->IsJSArray()) return *isolate->factory()->undefined_value(); 58 if (!stack_trace->IsJSArray()) return *isolate->factory()->undefined_value();
59 59
60 Handle<Object> formatted_stack_trace; 60 Handle<Object> formatted_stack_trace;
61 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 61 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
62 isolate, formatted_stack_trace, 62 isolate, formatted_stack_trace,
63 FormatStackTrace(isolate, object, stack_trace)); 63 ErrorUtils::FormatStackTrace(isolate, object, stack_trace));
64 64
65 PropertyDescriptor desc; 65 PropertyDescriptor desc;
66 desc.set_configurable(true); 66 desc.set_configurable(true);
67 desc.set_writable(true); 67 desc.set_writable(true);
68 desc.set_value(formatted_stack_trace); 68 desc.set_value(formatted_stack_trace);
69 Maybe<bool> status = JSReceiver::DefineOwnProperty( 69 Maybe<bool> status = JSReceiver::DefineOwnProperty(
70 isolate, object, isolate->factory()->stack_string(), &desc, 70 isolate, object, isolate->factory()->stack_string(), &desc,
71 Object::THROW_ON_ERROR); 71 Object::THROW_ON_ERROR);
72 if (!status.IsJust()) return isolate->heap()->exception(); 72 if (!status.IsJust()) return isolate->heap()->exception();
73 CHECK(status.FromJust()); 73 CHECK(status.FromJust());
(...skipping 21 matching lines...) Expand all
95 95
96 RETURN_RESULT_OR_FAILURE( 96 RETURN_RESULT_OR_FAILURE(
97 isolate, 97 isolate,
98 ErrorUtils::MakeGenericError( 98 ErrorUtils::MakeGenericError(
99 isolate, Handle<JSFunction>::cast(constructor), 99 isolate, Handle<JSFunction>::cast(constructor),
100 Smi::cast(*template_index)->value(), arg0, arg1, arg2, SKIP_FIRST)); 100 Smi::cast(*template_index)->value(), arg0, arg1, arg2, SKIP_FIRST));
101 } 101 }
102 102
103 } // namespace internal 103 } // namespace internal
104 } // namespace v8 104 } // namespace v8
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698