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

Side by Side Diff: src/runtime.cc

Issue 227483007: Handlify LiveEdit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/liveedit.cc ('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 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 13425 matching lines...) Expand 10 before | Expand all | Expand 10 after
13436 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditGatherCompileInfo) { 13436 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditGatherCompileInfo) {
13437 HandleScope scope(isolate); 13437 HandleScope scope(isolate);
13438 CHECK(isolate->debugger()->live_edit_enabled()); 13438 CHECK(isolate->debugger()->live_edit_enabled());
13439 ASSERT(args.length() == 2); 13439 ASSERT(args.length() == 2);
13440 CONVERT_ARG_CHECKED(JSValue, script, 0); 13440 CONVERT_ARG_CHECKED(JSValue, script, 0);
13441 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); 13441 CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
13442 13442
13443 RUNTIME_ASSERT(script->value()->IsScript()); 13443 RUNTIME_ASSERT(script->value()->IsScript());
13444 Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); 13444 Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
13445 13445
13446 JSArray* result = LiveEdit::GatherCompileInfo(script_handle, source); 13446 Handle<JSArray> result;
13447 13447 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
13448 if (isolate->has_pending_exception()) { 13448 isolate, result, LiveEdit::GatherCompileInfo(script_handle, source));
13449 return Failure::Exception(); 13449 return *result;
13450 }
13451
13452 return result;
13453 } 13450 }
13454 13451
13455 13452
13456 // Changes the source of the script to a new_source. 13453 // Changes the source of the script to a new_source.
13457 // If old_script_name is provided (i.e. is a String), also creates a copy of 13454 // If old_script_name is provided (i.e. is a String), also creates a copy of
13458 // the script with its original source and sends notification to debugger. 13455 // the script with its original source and sends notification to debugger.
13459 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceScript) { 13456 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceScript) {
13460 HandleScope scope(isolate); 13457 HandleScope scope(isolate);
13461 CHECK(isolate->debugger()->live_edit_enabled()); 13458 CHECK(isolate->debugger()->live_edit_enabled());
13462 ASSERT(args.length() == 3); 13459 ASSERT(args.length() == 3);
13463 CONVERT_ARG_CHECKED(JSValue, original_script_value, 0); 13460 CONVERT_ARG_CHECKED(JSValue, original_script_value, 0);
13464 CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1); 13461 CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1);
13465 Handle<Object> old_script_name(args[2], isolate); 13462 Handle<Object> old_script_name(args[2], isolate);
13466 13463
13467 RUNTIME_ASSERT(original_script_value->value()->IsScript()); 13464 RUNTIME_ASSERT(original_script_value->value()->IsScript());
13468 Handle<Script> original_script(Script::cast(original_script_value->value())); 13465 Handle<Script> original_script(Script::cast(original_script_value->value()));
13469 13466
13470 Object* old_script = LiveEdit::ChangeScriptSource(original_script, 13467 Handle<Object> old_script = LiveEdit::ChangeScriptSource(
13471 new_source, 13468 original_script, new_source, old_script_name);
13472 old_script_name);
13473 13469
13474 if (old_script->IsScript()) { 13470 if (old_script->IsScript()) {
13475 Handle<Script> script_handle(Script::cast(old_script)); 13471 Handle<Script> script_handle = Handle<Script>::cast(old_script);
13476 return *(GetScriptWrapper(script_handle)); 13472 return *(GetScriptWrapper(script_handle));
13477 } else { 13473 } else {
13478 return isolate->heap()->null_value(); 13474 return isolate->heap()->null_value();
13479 } 13475 }
13480 } 13476 }
13481 13477
13482 13478
13483 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSourceUpdated) { 13479 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSourceUpdated) {
13484 HandleScope scope(isolate); 13480 HandleScope scope(isolate);
13485 CHECK(isolate->debugger()->live_edit_enabled()); 13481 CHECK(isolate->debugger()->live_edit_enabled());
13486 ASSERT(args.length() == 1); 13482 ASSERT(args.length() == 1);
13487 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0); 13483 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0);
13488 return LiveEdit::FunctionSourceUpdated(shared_info); 13484 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_info));
13485
13486 LiveEdit::FunctionSourceUpdated(shared_info);
13487 return isolate->heap()->undefined_value();
13489 } 13488 }
13490 13489
13491 13490
13492 // Replaces code of SharedFunctionInfo with a new one. 13491 // Replaces code of SharedFunctionInfo with a new one.
13493 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceFunctionCode) { 13492 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceFunctionCode) {
13494 HandleScope scope(isolate); 13493 HandleScope scope(isolate);
13495 CHECK(isolate->debugger()->live_edit_enabled()); 13494 CHECK(isolate->debugger()->live_edit_enabled());
13496 ASSERT(args.length() == 2); 13495 ASSERT(args.length() == 2);
13497 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0); 13496 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0);
13498 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 1); 13497 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 1);
13498 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_info));
13499 13499
13500 return LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info); 13500 LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info);
13501 return isolate->heap()->undefined_value();
13501 } 13502 }
13502 13503
13503 13504
13504 // Connects SharedFunctionInfo to another script. 13505 // Connects SharedFunctionInfo to another script.
13505 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSetScript) { 13506 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditFunctionSetScript) {
13506 HandleScope scope(isolate); 13507 HandleScope scope(isolate);
13507 CHECK(isolate->debugger()->live_edit_enabled()); 13508 CHECK(isolate->debugger()->live_edit_enabled());
13508 ASSERT(args.length() == 2); 13509 ASSERT(args.length() == 2);
13509 Handle<Object> function_object(args[0], isolate); 13510 Handle<Object> function_object(args[0], isolate);
13510 Handle<Object> script_object(args[1], isolate); 13511 Handle<Object> script_object(args[1], isolate);
(...skipping 20 matching lines...) Expand all
13531 // with a substitution one. 13532 // with a substitution one.
13532 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceRefToNestedFunction) { 13533 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditReplaceRefToNestedFunction) {
13533 HandleScope scope(isolate); 13534 HandleScope scope(isolate);
13534 CHECK(isolate->debugger()->live_edit_enabled()); 13535 CHECK(isolate->debugger()->live_edit_enabled());
13535 ASSERT(args.length() == 3); 13536 ASSERT(args.length() == 3);
13536 13537
13537 CONVERT_ARG_HANDLE_CHECKED(JSValue, parent_wrapper, 0); 13538 CONVERT_ARG_HANDLE_CHECKED(JSValue, parent_wrapper, 0);
13538 CONVERT_ARG_HANDLE_CHECKED(JSValue, orig_wrapper, 1); 13539 CONVERT_ARG_HANDLE_CHECKED(JSValue, orig_wrapper, 1);
13539 CONVERT_ARG_HANDLE_CHECKED(JSValue, subst_wrapper, 2); 13540 CONVERT_ARG_HANDLE_CHECKED(JSValue, subst_wrapper, 2);
13540 13541
13541 LiveEdit::ReplaceRefToNestedFunction(parent_wrapper, orig_wrapper, 13542 LiveEdit::ReplaceRefToNestedFunction(
13542 subst_wrapper); 13543 parent_wrapper, orig_wrapper, subst_wrapper);
13543
13544 return isolate->heap()->undefined_value(); 13544 return isolate->heap()->undefined_value();
13545 } 13545 }
13546 13546
13547 13547
13548 // Updates positions of a shared function info (first parameter) according 13548 // Updates positions of a shared function info (first parameter) according
13549 // to script source change. Text change is described in second parameter as 13549 // to script source change. Text change is described in second parameter as
13550 // array of groups of 3 numbers: 13550 // array of groups of 3 numbers:
13551 // (change_begin, change_end, change_end_new_position). 13551 // (change_begin, change_end, change_end_new_position).
13552 // Each group describes a change in text; groups are sorted by change_begin. 13552 // Each group describes a change in text; groups are sorted by change_begin.
13553 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditPatchFunctionPositions) { 13553 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditPatchFunctionPositions) {
13554 HandleScope scope(isolate); 13554 HandleScope scope(isolate);
13555 CHECK(isolate->debugger()->live_edit_enabled()); 13555 CHECK(isolate->debugger()->live_edit_enabled());
13556 ASSERT(args.length() == 2); 13556 ASSERT(args.length() == 2);
13557 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); 13557 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0);
13558 CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1); 13558 CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1);
13559 13559
13560 return LiveEdit::PatchFunctionPositions(shared_array, position_change_array); 13560 LiveEdit::PatchFunctionPositions(shared_array, position_change_array);
13561 return isolate->heap()->undefined_value();
13561 } 13562 }
13562 13563
13563 13564
13564 // For array of SharedFunctionInfo's (each wrapped in JSValue) 13565 // For array of SharedFunctionInfo's (each wrapped in JSValue)
13565 // checks that none of them have activations on stacks (of any thread). 13566 // checks that none of them have activations on stacks (of any thread).
13566 // Returns array of the same length with corresponding results of 13567 // Returns array of the same length with corresponding results of
13567 // LiveEdit::FunctionPatchabilityStatus type. 13568 // LiveEdit::FunctionPatchabilityStatus type.
13568 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) { 13569 RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCheckAndDropActivations) {
13569 HandleScope scope(isolate); 13570 HandleScope scope(isolate);
13570 CHECK(isolate->debugger()->live_edit_enabled()); 13571 CHECK(isolate->debugger()->live_edit_enabled());
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
15259 } 15260 }
15260 } 15261 }
15261 15262
15262 15263
15263 void Runtime::OutOfMemory() { 15264 void Runtime::OutOfMemory() {
15264 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15265 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15265 UNREACHABLE(); 15266 UNREACHABLE();
15266 } 15267 }
15267 15268
15268 } } // namespace v8::internal 15269 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698