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/builtins/builtins-error.cc

Issue 2177183002: Make stack property collected by captureStackTrace non-enumerable and -writable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | 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 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/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/messages.h" 9 #include "src/messages.h"
10 #include "src/property-descriptor.h" 10 #include "src/property-descriptor.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Eagerly format the stack trace and set the stack property. 43 // Eagerly format the stack trace and set the stack property.
44 44
45 Handle<Object> stack_trace = 45 Handle<Object> stack_trace =
46 isolate->CaptureSimpleStackTrace(object, mode, caller); 46 isolate->CaptureSimpleStackTrace(object, mode, caller);
47 47
48 Handle<Object> formatted_stack_trace; 48 Handle<Object> formatted_stack_trace;
49 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 49 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
50 isolate, formatted_stack_trace, 50 isolate, formatted_stack_trace,
51 FormatStackTrace(isolate, object, stack_trace)); 51 FormatStackTrace(isolate, object, stack_trace));
52 52
53 RETURN_FAILURE_ON_EXCEPTION( 53 PropertyDescriptor desc;
54 isolate, JSObject::SetProperty(object, isolate->factory()->stack_string(), 54 desc.set_configurable(true);
55 formatted_stack_trace, STRICT)); 55 desc.set_value(formatted_stack_trace);
56 56 Maybe<bool> status = JSReceiver::DefineOwnProperty(
57 return *isolate->factory()->undefined_value(); 57 isolate, object, isolate->factory()->stack_string(), &desc,
58 Object::THROW_ON_ERROR);
59 if (!status.IsJust()) return isolate->heap()->exception();
60 CHECK(status.FromJust());
61 return isolate->heap()->undefined_value();
58 } 62 }
59 63
60 namespace { 64 namespace {
61 65
62 MaybeHandle<String> GetStringPropertyOrDefault(Isolate* isolate, 66 MaybeHandle<String> GetStringPropertyOrDefault(Isolate* isolate,
63 Handle<JSReceiver> recv, 67 Handle<JSReceiver> recv,
64 Handle<String> key, 68 Handle<String> key,
65 Handle<String> default_str) { 69 Handle<String> default_str) {
66 Handle<Object> obj; 70 Handle<Object> obj;
67 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, JSObject::GetProperty(recv, key), 71 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, JSObject::GetProperty(recv, key),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // the code unit 0x0020 (SPACE), and msg. 121 // the code unit 0x0020 (SPACE), and msg.
118 IncrementalStringBuilder builder(isolate); 122 IncrementalStringBuilder builder(isolate);
119 builder.AppendString(name); 123 builder.AppendString(name);
120 builder.AppendCString(": "); 124 builder.AppendCString(": ");
121 builder.AppendString(msg); 125 builder.AppendString(msg);
122 RETURN_RESULT_OR_FAILURE(isolate, builder.Finish()); 126 RETURN_RESULT_OR_FAILURE(isolate, builder.Finish());
123 } 127 }
124 128
125 } // namespace internal 129 } // namespace internal
126 } // namespace v8 130 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/stack-traces.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698