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

Unified Diff: src/runtime/runtime-internal.cc

Issue 1752133004: [proxies] throw TypeError in [[Call]] if is_callable Map bit is unset (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/runtime/runtime-internal.cc
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index 34b844a8984aa9dbbc1ec17e7d48e9b9f633079c..b02faf3a978775ea95c2ed755d014540c5442f61 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -377,61 +377,11 @@ RUNTIME_FUNCTION(Runtime_IncrementStatsCounter) {
}
-namespace {
-
-bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
- JavaScriptFrameIterator it(isolate);
- if (!it.done()) {
- JavaScriptFrame* frame = it.frame();
- JSFunction* fun = frame->function();
- Object* script = fun->shared()->script();
- if (script->IsScript() &&
- !(Script::cast(script)->source()->IsUndefined())) {
- Handle<Script> casted_script(Script::cast(script));
- // Compute the location from the function and the relocation info of the
- // baseline code. For optimized code this will use the deoptimization
- // information to get canonical location information.
- List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
- it.frame()->Summarize(&frames);
- FrameSummary& summary = frames.last();
- int pos = summary.abstract_code()->SourcePosition(summary.code_offset());
- *target = MessageLocation(casted_script, pos, pos + 1, handle(fun));
- return true;
- }
- }
- return false;
-}
-
-
-Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
- MessageLocation location;
- if (ComputeLocation(isolate, &location)) {
- Zone zone;
- base::SmartPointer<ParseInfo> info(
- location.function()->shared()->is_function()
- ? new ParseInfo(&zone, location.function())
- : new ParseInfo(&zone, location.script()));
- if (Parser::ParseStatic(info.get())) {
- CallPrinter printer(isolate, location.function()->shared()->IsBuiltin());
- const char* string = printer.Print(info->literal(), location.start_pos());
- if (strlen(string) > 0) {
- return isolate->factory()->NewStringFromAsciiChecked(string);
- }
- } else {
- isolate->clear_pending_exception();
- }
- }
- return Object::TypeOf(isolate, object);
-}
-
-} // namespace
-
-
RUNTIME_FUNCTION(Runtime_ThrowCalledNonCallable) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
- Handle<String> callsite = RenderCallSite(isolate, object);
+ Handle<String> callsite = Runtime::RenderCallSite(isolate, object);
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kCalledNonCallable, callsite));
}
@@ -441,7 +391,7 @@ RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
- Handle<String> callsite = RenderCallSite(isolate, object);
+ Handle<String> callsite = Runtime::RenderCallSite(isolate, object);
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kNotConstructor, callsite));
}

Powered by Google App Engine
This is Rietveld 408576698