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

Side by Side Diff: src/runtime/runtime-internal.cc

Issue 2628973005: [runtime] Change MessageLocation::function to SFI. (Closed)
Patch Set: Rebased. Created 3 years, 11 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/messages.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 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 326
327 bool ComputeLocation(Isolate* isolate, MessageLocation* target) { 327 bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
328 JavaScriptFrameIterator it(isolate); 328 JavaScriptFrameIterator it(isolate);
329 if (!it.done()) { 329 if (!it.done()) {
330 // Compute the location from the function and the relocation info of the 330 // Compute the location from the function and the relocation info of the
331 // baseline code. For optimized code this will use the deoptimization 331 // baseline code. For optimized code this will use the deoptimization
332 // information to get canonical location information. 332 // information to get canonical location information.
333 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); 333 List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
334 it.frame()->Summarize(&frames); 334 it.frame()->Summarize(&frames);
335 auto& summary = frames.last().AsJavaScript(); 335 auto& summary = frames.last().AsJavaScript();
336 Handle<JSFunction> function = summary.function(); 336 Handle<SharedFunctionInfo> shared(summary.function()->shared());
337 Handle<Object> script(function->shared()->script(), isolate); 337 Handle<Object> script(shared->script(), isolate);
338 int pos = summary.abstract_code()->SourcePosition(summary.code_offset()); 338 int pos = summary.abstract_code()->SourcePosition(summary.code_offset());
339 if (script->IsScript() && 339 if (script->IsScript() &&
340 !(Handle<Script>::cast(script)->source()->IsUndefined(isolate))) { 340 !(Handle<Script>::cast(script)->source()->IsUndefined(isolate))) {
341 Handle<Script> casted_script = Handle<Script>::cast(script); 341 Handle<Script> casted_script = Handle<Script>::cast(script);
342 *target = MessageLocation(casted_script, pos, pos + 1, function); 342 *target = MessageLocation(casted_script, pos, pos + 1, shared);
343 return true; 343 return true;
344 } 344 }
345 } 345 }
346 return false; 346 return false;
347 } 347 }
348 348
349 349
350 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { 350 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
351 MessageLocation location; 351 MessageLocation location;
352 if (ComputeLocation(isolate, &location)) { 352 if (ComputeLocation(isolate, &location)) {
353 Zone zone(isolate->allocator(), ZONE_NAME); 353 Zone zone(isolate->allocator(), ZONE_NAME);
354 std::unique_ptr<ParseInfo> info( 354 std::unique_ptr<ParseInfo> info(new ParseInfo(&zone, location.shared()));
355 new ParseInfo(&zone, handle(location.function()->shared())));
356 if (parsing::ParseAny(info.get())) { 355 if (parsing::ParseAny(info.get())) {
357 CallPrinter printer(isolate, 356 CallPrinter printer(isolate, location.shared()->IsUserJavaScript());
358 location.function()->shared()->IsUserJavaScript());
359 Handle<String> str = printer.Print(info->literal(), location.start_pos()); 357 Handle<String> str = printer.Print(info->literal(), location.start_pos());
360 if (str->length() > 0) return str; 358 if (str->length() > 0) return str;
361 } else { 359 } else {
362 isolate->clear_pending_exception(); 360 isolate->clear_pending_exception();
363 } 361 }
364 } 362 }
365 return Object::TypeOf(isolate, object); 363 return Object::TypeOf(isolate, object);
366 } 364 }
367 365
368 } // namespace 366 } // namespace
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 HandleScope scope(isolate); 491 HandleScope scope(isolate);
494 DCHECK_EQ(1, args.length()); 492 DCHECK_EQ(1, args.length());
495 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); 493 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
496 Handle<JSObject> global_proxy(target->global_proxy(), isolate); 494 Handle<JSObject> global_proxy(target->global_proxy(), isolate);
497 return *isolate->factory()->ToBoolean( 495 return *isolate->factory()->ToBoolean(
498 Builtins::AllowDynamicFunction(isolate, target, global_proxy)); 496 Builtins::AllowDynamicFunction(isolate, target, global_proxy));
499 } 497 }
500 498
501 } // namespace internal 499 } // namespace internal
502 } // namespace v8 500 } // namespace v8
OLDNEW
« no previous file with comments | « src/messages.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698