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

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 2451163003: [promises] Move PromiseReject to c++ (Closed)
Patch Set: make promise a jsobject Created 4 years, 1 month 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/runtime/runtime.h ('k') | src/runtime/runtime-internal.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug/debug-evaluate.h" 8 #include "src/debug/debug-evaluate.h"
9 #include "src/debug/debug-frames.h" 9 #include "src/debug/debug-frames.h"
10 #include "src/debug/debug-scopes.h" 10 #include "src/debug/debug-scopes.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return factory->NewJSArrayWithElements(result); 249 return factory->NewJSArrayWithElements(result);
250 } else if (object->IsJSPromise()) { 250 } else if (object->IsJSPromise()) {
251 Handle<JSObject> promise = Handle<JSObject>::cast(object); 251 Handle<JSObject> promise = Handle<JSObject>::cast(object);
252 252
253 Handle<Object> status_obj = 253 Handle<Object> status_obj =
254 DebugGetProperty(promise, isolate->factory()->promise_state_symbol()); 254 DebugGetProperty(promise, isolate->factory()->promise_state_symbol());
255 CHECK(status_obj->IsSmi()); 255 CHECK(status_obj->IsSmi());
256 const char* status = "rejected"; 256 const char* status = "rejected";
257 int status_val = Handle<Smi>::cast(status_obj)->value(); 257 int status_val = Handle<Smi>::cast(status_obj)->value();
258 switch (status_val) { 258 switch (status_val) {
259 case +1: 259 case kPromiseFulfilled:
260 status = "resolved"; 260 status = "resolved";
261 break; 261 break;
262 case 0: 262 case kPromisePending:
263 status = "pending"; 263 status = "pending";
264 break; 264 break;
265 default: 265 default:
266 DCHECK_EQ(-1, status_val); 266 DCHECK_EQ(kPromiseRejected, status_val);
267 } 267 }
268 268
269 Handle<FixedArray> result = factory->NewFixedArray(2 * 2); 269 Handle<FixedArray> result = factory->NewFixedArray(2 * 2);
270 Handle<String> promise_status = 270 Handle<String> promise_status =
271 factory->NewStringFromAsciiChecked("[[PromiseStatus]]"); 271 factory->NewStringFromAsciiChecked("[[PromiseStatus]]");
272 result->set(0, *promise_status); 272 result->set(0, *promise_status);
273 Handle<String> status_str = factory->NewStringFromAsciiChecked(status); 273 Handle<String> status_str = factory->NewStringFromAsciiChecked(status);
274 result->set(1, *status_str); 274 result->set(1, *status_str);
275 275
276 Handle<Object> value_obj = 276 Handle<Object> value_obj =
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 Handle<Script> script = Handle<Script>(Script::cast(script_val->value())); 1874 Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
1875 1875
1876 Handle<wasm::WasmDebugInfo> debug_info = 1876 Handle<wasm::WasmDebugInfo> debug_info =
1877 wasm::GetDebugInfo(handle(script->wasm_instance(), isolate)); 1877 wasm::GetDebugInfo(handle(script->wasm_instance(), isolate));
1878 return *wasm::WasmDebugInfo::DisassembleFunction( 1878 return *wasm::WasmDebugInfo::DisassembleFunction(
1879 debug_info, script->wasm_function_index()); 1879 debug_info, script->wasm_function_index());
1880 } 1880 }
1881 1881
1882 } // namespace internal 1882 } // namespace internal
1883 } // namespace v8 1883 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698