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

Side by Side Diff: src/execution.cc

Issue 1423723002: Map v8::Function to JSReceiver + IsCallable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/execution.h" 5 #include "src/execution.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 // static 179 // static
180 MaybeHandle<Object> Execution::New(Isolate* isolate, Handle<Object> constructor, 180 MaybeHandle<Object> Execution::New(Isolate* isolate, Handle<Object> constructor,
181 Handle<Object> new_target, int argc, 181 Handle<Object> new_target, int argc,
182 Handle<Object> argv[]) { 182 Handle<Object> argv[]) {
183 return Invoke(isolate, true, constructor, 183 return Invoke(isolate, true, constructor,
184 isolate->factory()->undefined_value(), argc, argv, new_target); 184 isolate->factory()->undefined_value(), argc, argv, new_target);
185 } 185 }
186 186
187 187
188 MaybeHandle<Object> Execution::TryCall(Handle<JSFunction> func, 188 MaybeHandle<Object> Execution::TryCall(Isolate* isolate, Handle<Object> func,
189 Handle<Object> receiver, int argc, 189 Handle<Object> receiver, int argc,
190 Handle<Object> args[], 190 Handle<Object> args[],
191 MaybeHandle<Object>* exception_out) { 191 MaybeHandle<Object>* exception_out) {
192 bool is_termination = false; 192 bool is_termination = false;
193 Isolate* isolate = func->GetIsolate();
194 MaybeHandle<Object> maybe_result; 193 MaybeHandle<Object> maybe_result;
195 if (exception_out != NULL) *exception_out = MaybeHandle<Object>(); 194 if (exception_out != NULL) *exception_out = MaybeHandle<Object>();
196 // Enter a try-block while executing the JavaScript code. To avoid 195 // Enter a try-block while executing the JavaScript code. To avoid
197 // duplicate error printing it must be non-verbose. Also, to avoid 196 // duplicate error printing it must be non-verbose. Also, to avoid
198 // creating message objects during stack overflow we shouldn't 197 // creating message objects during stack overflow we shouldn't
199 // capture messages. 198 // capture messages.
200 { 199 {
201 v8::TryCatch catcher(reinterpret_cast<v8::Isolate*>(isolate)); 200 v8::TryCatch catcher(reinterpret_cast<v8::Isolate*>(isolate));
202 catcher.SetVerbose(false); 201 catcher.SetVerbose(false);
203 catcher.SetCaptureMessage(false); 202 catcher.SetCaptureMessage(false);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 470 }
472 471
473 472
474 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, 473 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv,
475 Handle<JSFunction> fun, 474 Handle<JSFunction> fun,
476 Handle<Object> pos, 475 Handle<Object> pos,
477 Handle<Object> is_global) { 476 Handle<Object> is_global) {
478 Isolate* isolate = fun->GetIsolate(); 477 Isolate* isolate = fun->GetIsolate();
479 Handle<Object> args[] = { recv, fun, pos, is_global }; 478 Handle<Object> args[] = { recv, fun, pos, is_global };
480 MaybeHandle<Object> maybe_result = 479 MaybeHandle<Object> maybe_result =
481 TryCall(isolate->get_stack_trace_line_fun(), 480 TryCall(isolate, isolate->get_stack_trace_line_fun(),
482 isolate->factory()->undefined_value(), arraysize(args), args); 481 isolate->factory()->undefined_value(), arraysize(args), args);
483 Handle<Object> result; 482 Handle<Object> result;
484 if (!maybe_result.ToHandle(&result) || !result->IsString()) { 483 if (!maybe_result.ToHandle(&result) || !result->IsString()) {
485 return isolate->factory()->empty_string(); 484 return isolate->factory()->empty_string();
486 } 485 }
487 486
488 return Handle<String>::cast(result); 487 return Handle<String>::cast(result);
489 } 488 }
490 489
491 490
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 524
526 isolate_->counters()->stack_interrupts()->Increment(); 525 isolate_->counters()->stack_interrupts()->Increment();
527 isolate_->counters()->runtime_profiler_ticks()->Increment(); 526 isolate_->counters()->runtime_profiler_ticks()->Increment();
528 isolate_->runtime_profiler()->OptimizeNow(); 527 isolate_->runtime_profiler()->OptimizeNow();
529 528
530 return isolate_->heap()->undefined_value(); 529 return isolate_->heap()->undefined_value();
531 } 530 }
532 531
533 } // namespace internal 532 } // namespace internal
534 } // namespace v8 533 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698