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

Side by Side Diff: src/runtime.cc

Issue 23661004: add isolate parameter for Execution::Call (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | test/cctest/cctest.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 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 8649 matching lines...) Expand 10 before | Expand all | Expand 10 after
8660 for (int i = 0; i < argc; ++i) { 8660 for (int i = 0; i < argc; ++i) {
8661 MaybeObject* maybe = args[1 + i]; 8661 MaybeObject* maybe = args[1 + i];
8662 Object* object; 8662 Object* object;
8663 if (!maybe->To<Object>(&object)) return maybe; 8663 if (!maybe->To<Object>(&object)) return maybe;
8664 argv[i] = Handle<Object>(object, isolate); 8664 argv[i] = Handle<Object>(object, isolate);
8665 } 8665 }
8666 8666
8667 bool threw; 8667 bool threw;
8668 Handle<JSReceiver> hfun(fun); 8668 Handle<JSReceiver> hfun(fun);
8669 Handle<Object> hreceiver(receiver, isolate); 8669 Handle<Object> hreceiver(receiver, isolate);
8670 Handle<Object> result = 8670 Handle<Object> result = Execution::Call(
8671 Execution::Call(hfun, hreceiver, argc, argv, &threw, true); 8671 isolate, hfun, hreceiver, argc, argv, &threw, true);
8672 8672
8673 if (threw) return Failure::Exception(); 8673 if (threw) return Failure::Exception();
8674 return *result; 8674 return *result;
8675 } 8675 }
8676 8676
8677 8677
8678 RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) { 8678 RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) {
8679 HandleScope scope(isolate); 8679 HandleScope scope(isolate);
8680 ASSERT(args.length() == 5); 8680 ASSERT(args.length() == 5);
8681 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0); 8681 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0);
(...skipping 13 matching lines...) Expand all
8695 argv = new Handle<Object>[argc]; 8695 argv = new Handle<Object>[argc];
8696 if (argv == NULL) return isolate->StackOverflow(); 8696 if (argv == NULL) return isolate->StackOverflow();
8697 argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv); 8697 argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv);
8698 } 8698 }
8699 8699
8700 for (int i = 0; i < argc; ++i) { 8700 for (int i = 0; i < argc; ++i) {
8701 argv[i] = Object::GetElement(isolate, arguments, offset + i); 8701 argv[i] = Object::GetElement(isolate, arguments, offset + i);
8702 } 8702 }
8703 8703
8704 bool threw; 8704 bool threw;
8705 Handle<Object> result = 8705 Handle<Object> result = Execution::Call(
8706 Execution::Call(fun, receiver, argc, argv, &threw, true); 8706 isolate, fun, receiver, argc, argv, &threw, true);
8707 8707
8708 if (threw) return Failure::Exception(); 8708 if (threw) return Failure::Exception();
8709 return *result; 8709 return *result;
8710 } 8710 }
8711 8711
8712 8712
8713 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionDelegate) { 8713 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionDelegate) {
8714 HandleScope scope(isolate); 8714 HandleScope scope(isolate);
8715 ASSERT(args.length() == 1); 8715 ASSERT(args.length() == 1);
8716 RUNTIME_ASSERT(!args[0]->IsJSFunction()); 8716 RUNTIME_ASSERT(!args[0]->IsJSFunction());
(...skipping 3858 matching lines...) Expand 10 before | Expand all | Expand 10 after
12575 CLASSIC_MODE, 12575 CLASSIC_MODE,
12576 NO_PARSE_RESTRICTION, 12576 NO_PARSE_RESTRICTION,
12577 RelocInfo::kNoPosition); 12577 RelocInfo::kNoPosition);
12578 RETURN_IF_EMPTY_HANDLE(isolate, shared); 12578 RETURN_IF_EMPTY_HANDLE(isolate, shared);
12579 12579
12580 Handle<JSFunction> eval_fun = 12580 Handle<JSFunction> eval_fun =
12581 isolate->factory()->NewFunctionFromSharedFunctionInfo( 12581 isolate->factory()->NewFunctionFromSharedFunctionInfo(
12582 shared, context, NOT_TENURED); 12582 shared, context, NOT_TENURED);
12583 bool pending_exception; 12583 bool pending_exception;
12584 Handle<Object> result = Execution::Call( 12584 Handle<Object> result = Execution::Call(
12585 eval_fun, receiver, 0, NULL, &pending_exception); 12585 isolate, eval_fun, receiver, 0, NULL, &pending_exception);
12586 12586
12587 if (pending_exception) return Failure::Exception(); 12587 if (pending_exception) return Failure::Exception();
12588 12588
12589 // Skip the global proxy as it has no properties and always delegates to the 12589 // Skip the global proxy as it has no properties and always delegates to the
12590 // real global object. 12590 // real global object.
12591 if (result->IsJSGlobalProxy()) { 12591 if (result->IsJSGlobalProxy()) {
12592 result = Handle<JSObject>(JSObject::cast(result->GetPrototype(isolate))); 12592 result = Handle<JSObject>(JSObject::cast(result->GetPrototype(isolate)));
12593 } 12593 }
12594 12594
12595 // Clear the oneshot breakpoints so that the debugger does not step further. 12595 // Clear the oneshot breakpoints so that the debugger does not step further.
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
13346 RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) { 13346 RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) {
13347 HandleScope scope(isolate); 13347 HandleScope scope(isolate);
13348 ASSERT(args.length() == 2); 13348 ASSERT(args.length() == 2);
13349 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 13349 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
13350 CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1); 13350 CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1);
13351 13351
13352 Handle<Object> result; 13352 Handle<Object> result;
13353 bool pending_exception; 13353 bool pending_exception;
13354 { 13354 {
13355 if (without_debugger) { 13355 if (without_debugger) {
13356 result = Execution::Call(function, isolate->global_object(), 0, NULL, 13356 result = Execution::Call(isolate,
13357 function,
13358 isolate->global_object(),
13359 0,
13360 NULL,
13357 &pending_exception); 13361 &pending_exception);
13358 } else { 13362 } else {
13359 EnterDebugger enter_debugger(isolate); 13363 EnterDebugger enter_debugger(isolate);
13360 result = Execution::Call(function, isolate->global_object(), 0, NULL, 13364 result = Execution::Call(isolate,
13365 function,
13366 isolate->global_object(),
13367 0,
13368 NULL,
13361 &pending_exception); 13369 &pending_exception);
13362 } 13370 }
13363 } 13371 }
13364 if (!pending_exception) { 13372 if (!pending_exception) {
13365 return *result; 13373 return *result;
13366 } else { 13374 } else {
13367 return Failure::Exception(); 13375 return Failure::Exception();
13368 } 13376 }
13369 } 13377 }
13370 13378
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
14217 Handle<Object> value; 14225 Handle<Object> value;
14218 { 14226 {
14219 Handle<JSFunction> factory(JSFunction::cast( 14227 Handle<JSFunction> factory(JSFunction::cast(
14220 cache_handle->get(JSFunctionResultCache::kFactoryIndex))); 14228 cache_handle->get(JSFunctionResultCache::kFactoryIndex)));
14221 // TODO(antonm): consider passing a receiver when constructing a cache. 14229 // TODO(antonm): consider passing a receiver when constructing a cache.
14222 Handle<Object> receiver(isolate->native_context()->global_object(), 14230 Handle<Object> receiver(isolate->native_context()->global_object(),
14223 isolate); 14231 isolate);
14224 // This handle is nor shared, nor used later, so it's safe. 14232 // This handle is nor shared, nor used later, so it's safe.
14225 Handle<Object> argv[] = { key_handle }; 14233 Handle<Object> argv[] = { key_handle };
14226 bool pending_exception; 14234 bool pending_exception;
14227 value = Execution::Call(factory, 14235 value = Execution::Call(isolate,
14236 factory,
14228 receiver, 14237 receiver,
14229 ARRAY_SIZE(argv), 14238 ARRAY_SIZE(argv),
14230 argv, 14239 argv,
14231 &pending_exception); 14240 &pending_exception);
14232 if (pending_exception) return Failure::Exception(); 14241 if (pending_exception) return Failure::Exception();
14233 } 14242 }
14234 14243
14235 #ifdef VERIFY_HEAP 14244 #ifdef VERIFY_HEAP
14236 if (FLAG_verify_heap) { 14245 if (FLAG_verify_heap) {
14237 cache_handle->JSFunctionResultCacheVerify(); 14246 cache_handle->JSFunctionResultCacheVerify();
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
14651 // Handle last resort GC and make sure to allow future allocations 14660 // Handle last resort GC and make sure to allow future allocations
14652 // to grow the heap without causing GCs (if possible). 14661 // to grow the heap without causing GCs (if possible).
14653 isolate->counters()->gc_last_resort_from_js()->Increment(); 14662 isolate->counters()->gc_last_resort_from_js()->Increment();
14654 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14663 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14655 "Runtime::PerformGC"); 14664 "Runtime::PerformGC");
14656 } 14665 }
14657 } 14666 }
14658 14667
14659 14668
14660 } } // namespace v8::internal 14669 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/cctest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698