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

Side by Side Diff: src/runtime.cc

Issue 64223010: Harmony promises (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ignore multiple resolution Created 7 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 | Annotate | Revision Log
« src/promise.js ('K') | « src/runtime.h ('k') | src/v8.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 InstallBuiltin(isolate, holder, "shift", Builtins::kArrayShift); 2623 InstallBuiltin(isolate, holder, "shift", Builtins::kArrayShift);
2624 InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift); 2624 InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift);
2625 InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice); 2625 InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice);
2626 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice); 2626 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice);
2627 InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat); 2627 InstallBuiltin(isolate, holder, "concat", Builtins::kArrayConcat);
2628 2628
2629 return *holder; 2629 return *holder;
2630 } 2630 }
2631 2631
2632 2632
2633 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsCallable) {
2634 SealHandleScope shs(isolate);
2635 ASSERT(args.length() == 1);
2636 CONVERT_ARG_CHECKED(Object, obj, 0);
2637 return isolate->heap()->ToBoolean(obj->IsCallable());
2638 }
2639
2640
2633 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsClassicModeFunction) { 2641 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsClassicModeFunction) {
2634 SealHandleScope shs(isolate); 2642 SealHandleScope shs(isolate);
2635 ASSERT(args.length() == 1); 2643 ASSERT(args.length() == 1);
2636 CONVERT_ARG_CHECKED(JSReceiver, callable, 0); 2644 CONVERT_ARG_CHECKED(JSReceiver, callable, 0);
2637 if (!callable->IsJSFunction()) { 2645 if (!callable->IsJSFunction()) {
2638 HandleScope scope(isolate); 2646 HandleScope scope(isolate);
2639 bool threw = false; 2647 bool threw = false;
2640 Handle<Object> delegate = Execution::TryGetFunctionDelegate( 2648 Handle<Object> delegate = Execution::TryGetFunctionDelegate(
2641 isolate, Handle<JSReceiver>(callable), &threw); 2649 isolate, Handle<JSReceiver>(callable), &threw);
2642 if (threw) return Failure::Exception(); 2650 if (threw) return Failure::Exception();
(...skipping 11675 matching lines...) Expand 10 before | Expand all | Expand 10 after
14318 ASSERT(args.length() == 2); 14326 ASSERT(args.length() == 2);
14319 OS::PrintError("abort: %s\n", 14327 OS::PrintError("abort: %s\n",
14320 reinterpret_cast<char*>(args[0]) + args.smi_at(1)); 14328 reinterpret_cast<char*>(args[0]) + args.smi_at(1));
14321 isolate->PrintStack(stderr); 14329 isolate->PrintStack(stderr);
14322 OS::Abort(); 14330 OS::Abort();
14323 UNREACHABLE(); 14331 UNREACHABLE();
14324 return NULL; 14332 return NULL;
14325 } 14333 }
14326 14334
14327 14335
14336 RUNTIME_FUNCTION(MaybeObject*, Runtime_AbortJS) {
14337 HandleScope scope(isolate);
14338 ASSERT(args.length() == 1);
14339 CONVERT_ARG_HANDLE_CHECKED(String, message, 0);
14340 OS::PrintError("abort: %s\n", *message->ToCString());
14341 isolate->PrintStack(stderr);
14342 OS::Abort();
14343 UNREACHABLE();
14344 return NULL;
14345 }
14346
14347
14328 RUNTIME_FUNCTION(MaybeObject*, Runtime_FlattenString) { 14348 RUNTIME_FUNCTION(MaybeObject*, Runtime_FlattenString) {
14329 HandleScope scope(isolate); 14349 HandleScope scope(isolate);
14330 ASSERT(args.length() == 1); 14350 ASSERT(args.length() == 1);
14331 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); 14351 CONVERT_ARG_HANDLE_CHECKED(String, str, 0);
14332 FlattenString(str); 14352 FlattenString(str);
14333 return isolate->heap()->undefined_value(); 14353 return isolate->heap()->undefined_value();
14334 } 14354 }
14335 14355
14336 14356
14337 RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyContextDisposed) { 14357 RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyContextDisposed) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
14610 return isolate->heap()->undefined_value(); 14630 return isolate->heap()->undefined_value();
14611 14631
14612 ASSERT(!(obj->map()->is_observed() && obj->IsJSObject() && 14632 ASSERT(!(obj->map()->is_observed() && obj->IsJSObject() &&
14613 Handle<JSObject>::cast(obj)->HasFastElements())); 14633 Handle<JSObject>::cast(obj)->HasFastElements()));
14614 ASSERT(obj->IsJSObject()); 14634 ASSERT(obj->IsJSObject());
14615 JSObject::SetObserved(Handle<JSObject>::cast(obj)); 14635 JSObject::SetObserved(Handle<JSObject>::cast(obj));
14616 return isolate->heap()->undefined_value(); 14636 return isolate->heap()->undefined_value();
14617 } 14637 }
14618 14638
14619 14639
14620 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetObserverDeliveryPending) { 14640 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetMicrotasksPending) {
14621 SealHandleScope shs(isolate); 14641 SealHandleScope shs(isolate);
14622 ASSERT(args.length() == 0); 14642 ASSERT(args.length() == 1);
14623 isolate->set_observer_delivery_pending(true); 14643 CONVERT_BOOLEAN_ARG_CHECKED(new_state, 0);
14624 return isolate->heap()->undefined_value(); 14644 bool old_state = isolate->microtasks_pending();
14645 isolate->set_microtasks_pending(new_state);
14646 return isolate->heap()->ToBoolean(old_state);
14625 } 14647 }
14626 14648
14627 14649
14628 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObservationState) { 14650 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObservationState) {
14629 SealHandleScope shs(isolate); 14651 SealHandleScope shs(isolate);
14630 ASSERT(args.length() == 0); 14652 ASSERT(args.length() == 0);
14631 return isolate->heap()->observation_state(); 14653 return isolate->heap()->observation_state();
14632 } 14654 }
14633 14655
14634 14656
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
14878 // Handle last resort GC and make sure to allow future allocations 14900 // Handle last resort GC and make sure to allow future allocations
14879 // to grow the heap without causing GCs (if possible). 14901 // to grow the heap without causing GCs (if possible).
14880 isolate->counters()->gc_last_resort_from_js()->Increment(); 14902 isolate->counters()->gc_last_resort_from_js()->Increment();
14881 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14903 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14882 "Runtime::PerformGC"); 14904 "Runtime::PerformGC");
14883 } 14905 }
14884 } 14906 }
14885 14907
14886 14908
14887 } } // namespace v8::internal 14909 } } // namespace v8::internal
OLDNEW
« src/promise.js ('K') | « src/runtime.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698