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

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

Issue 2609853004: [promises] Remove unused runtime calls (Closed)
Patch Set: Created 3 years, 11 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/runtime/runtime.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 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 #include "src/runtime/runtime-utils.h" 4 #include "src/runtime/runtime-utils.h"
5 5
6 #include "src/debug/debug.h" 6 #include "src/debug/debug.h"
7 #include "src/elements.h" 7 #include "src/elements.h"
8 #include "src/promise-utils.h" 8 #include "src/promise-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return Smi::FromInt(promise->status()); 273 return Smi::FromInt(promise->status());
274 } 274 }
275 275
276 RUNTIME_FUNCTION(Runtime_PromiseResult) { 276 RUNTIME_FUNCTION(Runtime_PromiseResult) {
277 HandleScope scope(isolate); 277 HandleScope scope(isolate);
278 DCHECK(args.length() == 1); 278 DCHECK(args.length() == 1);
279 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); 279 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
280 return promise->result(); 280 return promise->result();
281 } 281 }
282 282
283 RUNTIME_FUNCTION(Runtime_PromiseDeferred) {
284 HandleScope scope(isolate);
285 DCHECK(args.length() == 1);
286 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
287
288 Handle<Object> deferred(promise->deferred_promise(), isolate);
289 if (deferred->IsUndefined(isolate)) {
290 return isolate->heap()->undefined_value();
291 }
292
293 if (deferred->IsJSObject()) {
294 return *deferred;
295 }
296
297 DCHECK(deferred->IsFixedArray());
298 return *isolate->factory()->NewJSArrayWithElements(
299 Handle<FixedArray>::cast(deferred));
300 }
301
302 RUNTIME_FUNCTION(Runtime_PromiseRejectReactions) {
303 HandleScope scope(isolate);
304 DCHECK(args.length() == 1);
305 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
306
307 Handle<Object> reject_reactions(promise->reject_reactions(), isolate);
308 if (reject_reactions->IsUndefined(isolate)) {
309 return isolate->heap()->undefined_value();
310 }
311
312 if (reject_reactions->IsJSObject()) {
313 return *reject_reactions;
314 }
315
316 DCHECK(reject_reactions->IsFixedArray());
317 return *isolate->factory()->NewJSArrayWithElements(
318 Handle<FixedArray>::cast(reject_reactions));
319 }
320
321 RUNTIME_FUNCTION(Runtime_PromiseMarkAsHandled) { 283 RUNTIME_FUNCTION(Runtime_PromiseMarkAsHandled) {
322 SealHandleScope shs(isolate); 284 SealHandleScope shs(isolate);
323 DCHECK(args.length() == 1); 285 DCHECK(args.length() == 1);
324 CONVERT_ARG_CHECKED(JSPromise, promise, 0); 286 CONVERT_ARG_CHECKED(JSPromise, promise, 0);
325 287
326 promise->set_has_handler(true); 288 promise->set_has_handler(true);
327 return isolate->heap()->undefined_value(); 289 return isolate->heap()->undefined_value();
328 } 290 }
329 291
330 RUNTIME_FUNCTION(Runtime_PromiseMarkHandledHint) { 292 RUNTIME_FUNCTION(Runtime_PromiseMarkHandledHint) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 HandleScope scope(isolate); 329 HandleScope scope(isolate);
368 DCHECK_EQ(1, args.length()); 330 DCHECK_EQ(1, args.length());
369 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); 331 CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
370 isolate->RunPromiseHook(PromiseHookType::kAfter, promise, 332 isolate->RunPromiseHook(PromiseHookType::kAfter, promise,
371 isolate->factory()->undefined_value()); 333 isolate->factory()->undefined_value());
372 return isolate->heap()->undefined_value(); 334 return isolate->heap()->undefined_value();
373 } 335 }
374 336
375 } // namespace internal 337 } // namespace internal
376 } // namespace v8 338 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698