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

Side by Side Diff: src/factory.cc

Issue 1703453002: [interpreter, debugger] support debug breaks via bytecode array copy (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed last comment Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 Code); 1474 Code);
1475 } 1475 }
1476 1476
1477 1477
1478 Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { 1478 Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) {
1479 CALL_HEAP_FUNCTION(isolate(), 1479 CALL_HEAP_FUNCTION(isolate(),
1480 isolate()->heap()->CopyCode(*code, reloc_info), 1480 isolate()->heap()->CopyCode(*code, reloc_info),
1481 Code); 1481 Code);
1482 } 1482 }
1483 1483
1484 Handle<BytecodeArray> Factory::CopyBytecodeArray(
1485 Handle<BytecodeArray> bytecode_array) {
1486 CALL_HEAP_FUNCTION(isolate(),
1487 isolate()->heap()->CopyBytecodeArray(*bytecode_array),
1488 BytecodeArray);
1489 }
1484 1490
1485 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, 1491 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor,
1486 PretenureFlag pretenure) { 1492 PretenureFlag pretenure) {
1487 JSFunction::EnsureHasInitialMap(constructor); 1493 JSFunction::EnsureHasInitialMap(constructor);
1488 CALL_HEAP_FUNCTION( 1494 CALL_HEAP_FUNCTION(
1489 isolate(), 1495 isolate(),
1490 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); 1496 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject);
1491 } 1497 }
1492 1498
1493 1499
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 share->set_code(*code); 2128 share->set_code(*code);
2123 share->set_optimized_code_map(*cleared_optimized_code_map()); 2129 share->set_optimized_code_map(*cleared_optimized_code_map());
2124 share->set_scope_info(ScopeInfo::Empty(isolate())); 2130 share->set_scope_info(ScopeInfo::Empty(isolate()));
2125 Handle<Code> construct_stub = 2131 Handle<Code> construct_stub =
2126 is_constructor ? isolate()->builtins()->JSConstructStubGeneric() 2132 is_constructor ? isolate()->builtins()->JSConstructStubGeneric()
2127 : isolate()->builtins()->ConstructedNonConstructable(); 2133 : isolate()->builtins()->ConstructedNonConstructable();
2128 share->set_construct_stub(*construct_stub); 2134 share->set_construct_stub(*construct_stub);
2129 share->set_instance_class_name(*Object_string()); 2135 share->set_instance_class_name(*Object_string());
2130 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); 2136 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER);
2131 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); 2137 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER);
2132 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); 2138 share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER);
2133 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); 2139 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER);
2134 StaticFeedbackVectorSpec empty_spec; 2140 StaticFeedbackVectorSpec empty_spec;
2135 Handle<TypeFeedbackMetadata> feedback_metadata = 2141 Handle<TypeFeedbackMetadata> feedback_metadata =
2136 TypeFeedbackMetadata::New(isolate(), &empty_spec); 2142 TypeFeedbackMetadata::New(isolate(), &empty_spec);
2137 Handle<TypeFeedbackVector> feedback_vector = 2143 Handle<TypeFeedbackVector> feedback_vector =
2138 TypeFeedbackVector::New(isolate(), feedback_metadata); 2144 TypeFeedbackVector::New(isolate(), feedback_metadata);
2139 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); 2145 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER);
2140 #if TRACE_MAPS 2146 #if TRACE_MAPS
2141 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); 2147 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId());
2142 #endif 2148 #endif
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 Handle<FixedArray> break_points( 2250 Handle<FixedArray> break_points(
2245 NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction)); 2251 NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction));
2246 2252
2247 // Create and set up the debug info object. Debug info contains function, a 2253 // Create and set up the debug info object. Debug info contains function, a
2248 // copy of the original code, the executing code and initial fixed array for 2254 // copy of the original code, the executing code and initial fixed array for
2249 // active break points. 2255 // active break points.
2250 Handle<DebugInfo> debug_info = 2256 Handle<DebugInfo> debug_info =
2251 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); 2257 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE));
2252 debug_info->set_shared(*shared); 2258 debug_info->set_shared(*shared);
2253 if (shared->HasBytecodeArray()) { 2259 if (shared->HasBytecodeArray()) {
2254 debug_info->set_abstract_code(AbstractCode::cast(shared->bytecode_array())); 2260 // Create a copy for debugging.
2261 Handle<BytecodeArray> original(shared->bytecode_array(), isolate());
2262 Handle<BytecodeArray> copy = CopyBytecodeArray(original);
2263 debug_info->set_abstract_code(AbstractCode::cast(*copy));
2255 } else { 2264 } else {
2256 debug_info->set_abstract_code(AbstractCode::cast(shared->code())); 2265 debug_info->set_abstract_code(AbstractCode::cast(shared->code()));
2257 } 2266 }
2258 debug_info->set_break_points(*break_points); 2267 debug_info->set_break_points(*break_points);
2259 2268
2260 // Link debug info to function. 2269 // Link debug info to function.
2261 shared->set_debug_info(*debug_info); 2270 shared->set_debug_info(*debug_info);
2262 2271
2263 return debug_info; 2272 return debug_info;
2264 } 2273 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 } 2400 }
2392 2401
2393 2402
2394 Handle<Object> Factory::ToBoolean(bool value) { 2403 Handle<Object> Factory::ToBoolean(bool value) {
2395 return value ? true_value() : false_value(); 2404 return value ? true_value() : false_value();
2396 } 2405 }
2397 2406
2398 2407
2399 } // namespace internal 2408 } // namespace internal
2400 } // namespace v8 2409 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698