OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/debug/liveedit.h" | 5 #include "src/debug/liveedit.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compilation-cache.h" | 9 #include "src/compilation-cache.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 | 721 |
722 // Finds all references to original and replaces them with substitution. | 722 // Finds all references to original and replaces them with substitution. |
723 static void ReplaceCodeObject(Handle<Code> original, | 723 static void ReplaceCodeObject(Handle<Code> original, |
724 Handle<Code> substitution) { | 724 Handle<Code> substitution) { |
725 // Perform a full GC in order to ensure that we are not in the middle of an | 725 // Perform a full GC in order to ensure that we are not in the middle of an |
726 // incremental marking phase when we are replacing the code object. | 726 // incremental marking phase when we are replacing the code object. |
727 // Since we are not in an incremental marking phase we can write pointers | 727 // Since we are not in an incremental marking phase we can write pointers |
728 // to code objects (that are never in new space) without worrying about | 728 // to code objects (that are never in new space) without worrying about |
729 // write barriers. | 729 // write barriers. |
730 Heap* heap = original->GetHeap(); | 730 Heap* heap = original->GetHeap(); |
731 HeapIterator iterator(heap); | 731 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); |
732 // Now iterate over all pointers of all objects, including code_target | 732 // Now iterate over all pointers of all objects, including code_target |
733 // implicit pointers. | 733 // implicit pointers. |
734 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 734 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
735 if (obj->IsJSFunction()) { | 735 if (obj->IsJSFunction()) { |
736 JSFunction* fun = JSFunction::cast(obj); | 736 JSFunction* fun = JSFunction::cast(obj); |
737 if (fun->code() == *original) fun->ReplaceCode(*substitution); | 737 if (fun->code() == *original) fun->ReplaceCode(*substitution); |
738 } else if (obj->IsSharedFunctionInfo()) { | 738 } else if (obj->IsSharedFunctionInfo()) { |
739 SharedFunctionInfo* info = SharedFunctionInfo::cast(obj); | 739 SharedFunctionInfo* info = SharedFunctionInfo::cast(obj); |
740 if (info->code() == *original) info->set_code(*substitution); | 740 if (info->code() == *original) info->set_code(*substitution); |
741 } | 741 } |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 Handle<FixedArray> result, | 1395 Handle<FixedArray> result, |
1396 int len) { | 1396 int len) { |
1397 Isolate* isolate = shared_info_array->GetIsolate(); | 1397 Isolate* isolate = shared_info_array->GetIsolate(); |
1398 bool found_suspended_activations = false; | 1398 bool found_suspended_activations = false; |
1399 | 1399 |
1400 DCHECK_LE(len, result->length()); | 1400 DCHECK_LE(len, result->length()); |
1401 | 1401 |
1402 FunctionPatchabilityStatus active = FUNCTION_BLOCKED_ACTIVE_GENERATOR; | 1402 FunctionPatchabilityStatus active = FUNCTION_BLOCKED_ACTIVE_GENERATOR; |
1403 | 1403 |
1404 Heap* heap = isolate->heap(); | 1404 Heap* heap = isolate->heap(); |
1405 HeapIterator iterator(heap); | 1405 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); |
1406 HeapObject* obj = NULL; | 1406 HeapObject* obj = NULL; |
1407 while ((obj = iterator.next()) != NULL) { | 1407 while ((obj = iterator.next()) != NULL) { |
1408 if (!obj->IsJSGeneratorObject()) continue; | 1408 if (!obj->IsJSGeneratorObject()) continue; |
1409 | 1409 |
1410 JSGeneratorObject* gen = JSGeneratorObject::cast(obj); | 1410 JSGeneratorObject* gen = JSGeneratorObject::cast(obj); |
1411 if (gen->is_closed()) continue; | 1411 if (gen->is_closed()) continue; |
1412 | 1412 |
1413 HandleScope scope(isolate); | 1413 HandleScope scope(isolate); |
1414 | 1414 |
1415 for (int i = 0; i < len; i++) { | 1415 for (int i = 0; i < len; i++) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 scope_info_length++; | 1646 scope_info_length++; |
1647 | 1647 |
1648 current_scope = current_scope->outer_scope(); | 1648 current_scope = current_scope->outer_scope(); |
1649 } | 1649 } |
1650 | 1650 |
1651 return scope_info_list; | 1651 return scope_info_list; |
1652 } | 1652 } |
1653 | 1653 |
1654 } // namespace internal | 1654 } // namespace internal |
1655 } // namespace v8 | 1655 } // namespace v8 |
OLD | NEW |