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

Side by Side Diff: src/factory.cc

Issue 2096863003: [wasm] prototype for breakpoint support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@extend-script-functionality
Patch Set: Created 4 years, 5 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
« no previous file with comments | « src/factory.h ('k') | src/frames.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 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 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 str = DoubleToCString(num, buffer); 2231 str = DoubleToCString(num, buffer);
2232 } 2232 }
2233 2233
2234 // We tenure the allocated string since it is referenced from the 2234 // We tenure the allocated string since it is referenced from the
2235 // number-string cache which lives in the old space. 2235 // number-string cache which lives in the old space.
2236 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED); 2236 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED);
2237 SetNumberStringCache(number, js_string); 2237 SetNumberStringCache(number, js_string);
2238 return js_string; 2238 return js_string;
2239 } 2239 }
2240 2240
2241 2241 Handle<DebugInfo> Factory::NewDebugInfo(Handle<AbstractCode> code) {
2242 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
2243 // Allocate initial fixed array for active break points before allocating the 2242 // Allocate initial fixed array for active break points before allocating the
2244 // debug info object to avoid allocation while setting up the debug info 2243 // debug info object to avoid allocation while setting up the debug info
2245 // object. 2244 // object.
2246 Handle<FixedArray> break_points( 2245 Handle<FixedArray> break_points(
2247 NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction)); 2246 NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction));
2248 2247
2249 // Create and set up the debug info object. Debug info contains function, a 2248 // Create and set up the debug info object.
2250 // copy of the original code, the executing code and initial fixed array for
2251 // active break points.
2252 Handle<DebugInfo> debug_info = 2249 Handle<DebugInfo> debug_info =
2253 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); 2250 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE));
2254 debug_info->set_shared(*shared); 2251 debug_info->set_abstract_code(*code);
2252 debug_info->set_break_points(*break_points);
2253
2254 return debug_info;
2255 }
2256
2257 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
2258 AbstractCode* code;
2255 if (shared->HasBytecodeArray()) { 2259 if (shared->HasBytecodeArray()) {
2256 // We need to create a copy, but delay since this may cause heap 2260 // We need to create a copy, but delay since this may cause heap
2257 // verification. 2261 // verification.
2258 debug_info->set_abstract_code(AbstractCode::cast(shared->bytecode_array())); 2262 code = AbstractCode::cast(shared->bytecode_array());
2259 } else { 2263 } else {
2260 debug_info->set_abstract_code(AbstractCode::cast(shared->code())); 2264 code = AbstractCode::cast(shared->code());
2261 } 2265 }
2262 debug_info->set_break_points(*break_points); 2266
2267 Handle<DebugInfo> debug_info = NewDebugInfo(handle(code));
2268 debug_info->set_shared(*shared);
2263 if (shared->HasBytecodeArray()) { 2269 if (shared->HasBytecodeArray()) {
2264 // Create a copy for debugging. 2270 // Create a copy for debugging.
2265 Handle<BytecodeArray> original(shared->bytecode_array()); 2271 Handle<BytecodeArray> original(shared->bytecode_array());
2266 Handle<BytecodeArray> copy = CopyBytecodeArray(original); 2272 Handle<BytecodeArray> copy = CopyBytecodeArray(original);
2267 debug_info->set_abstract_code(AbstractCode::cast(*copy)); 2273 debug_info->set_abstract_code(AbstractCode::cast(*copy));
2268 } 2274 }
2269 2275
2270 // Link debug info to function. 2276 // Link debug info to function.
2271 shared->set_debug_info(*debug_info); 2277 shared->set_debug_info(*debug_info);
2272 2278
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 } 2398 }
2393 2399
2394 2400
2395 Handle<Object> Factory::ToBoolean(bool value) { 2401 Handle<Object> Factory::ToBoolean(bool value) {
2396 return value ? true_value() : false_value(); 2402 return value ? true_value() : false_value();
2397 } 2403 }
2398 2404
2399 2405
2400 } // namespace internal 2406 } // namespace internal
2401 } // namespace v8 2407 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698