OLD | NEW |
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" |
11 #include "src/messages.h" | |
12 #include "src/vm-state-inl.h" | 11 #include "src/vm-state-inl.h" |
13 | 12 |
14 namespace v8 { | 13 namespace v8 { |
15 namespace internal { | 14 namespace internal { |
16 | 15 |
17 StackGuard::StackGuard() | 16 StackGuard::StackGuard() |
18 : isolate_(NULL) { | 17 : isolate_(NULL) { |
19 } | 18 } |
20 | 19 |
21 | 20 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // Objects created through the API can have an instance-call handler | 272 // Objects created through the API can have an instance-call handler |
274 // that should be used when calling the object as a function. | 273 // that should be used when calling the object as a function. |
275 if (fun->IsHeapObject() && | 274 if (fun->IsHeapObject() && |
276 HeapObject::cast(fun)->map()->has_instance_call_handler()) { | 275 HeapObject::cast(fun)->map()->has_instance_call_handler()) { |
277 return Handle<JSFunction>( | 276 return Handle<JSFunction>( |
278 isolate->native_context()->call_as_function_delegate()); | 277 isolate->native_context()->call_as_function_delegate()); |
279 } | 278 } |
280 | 279 |
281 // If the Object doesn't have an instance-call handler we should | 280 // If the Object doesn't have an instance-call handler we should |
282 // throw a non-callable exception. | 281 // throw a non-callable exception. |
283 THROW_NEW_ERROR(isolate, | 282 THROW_NEW_ERROR(isolate, NewTypeError("called_non_callable", |
284 NewTypeError(MessageTemplate::kCalledNonCallable, object), | 283 i::HandleVector<i::Object>(&object, 1)), |
285 Object); | 284 Object); |
286 } | 285 } |
287 | 286 |
288 | 287 |
289 Handle<Object> Execution::GetConstructorDelegate(Isolate* isolate, | 288 Handle<Object> Execution::GetConstructorDelegate(Isolate* isolate, |
290 Handle<Object> object) { | 289 Handle<Object> object) { |
291 DCHECK(!object->IsJSFunction()); | 290 DCHECK(!object->IsJSFunction()); |
292 | 291 |
293 // If you return a function from here, it will be called when an | 292 // If you return a function from here, it will be called when an |
294 // attempt is made to call the given object as a constructor. | 293 // attempt is made to call the given object as a constructor. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Objects created through the API can have an instance-call handler | 328 // Objects created through the API can have an instance-call handler |
330 // that should be used when calling the object as a function. | 329 // that should be used when calling the object as a function. |
331 if (fun->IsHeapObject() && | 330 if (fun->IsHeapObject() && |
332 HeapObject::cast(fun)->map()->has_instance_call_handler()) { | 331 HeapObject::cast(fun)->map()->has_instance_call_handler()) { |
333 return Handle<JSFunction>( | 332 return Handle<JSFunction>( |
334 isolate->native_context()->call_as_constructor_delegate()); | 333 isolate->native_context()->call_as_constructor_delegate()); |
335 } | 334 } |
336 | 335 |
337 // If the Object doesn't have an instance-call handler we should | 336 // If the Object doesn't have an instance-call handler we should |
338 // throw a non-callable exception. | 337 // throw a non-callable exception. |
339 THROW_NEW_ERROR(isolate, | 338 THROW_NEW_ERROR(isolate, NewTypeError("called_non_callable", |
340 NewTypeError(MessageTemplate::kCalledNonCallable, object), | 339 i::HandleVector<i::Object>(&object, 1)), |
341 Object); | 340 Object); |
342 } | 341 } |
343 | 342 |
344 | 343 |
345 void StackGuard::EnableInterrupts() { | 344 void StackGuard::EnableInterrupts() { |
346 ExecutionAccess access(isolate_); | 345 ExecutionAccess access(isolate_); |
347 if (has_pending_interrupts(access)) { | 346 if (has_pending_interrupts(access)) { |
348 set_interrupt_limits(access); | 347 set_interrupt_limits(access); |
349 } | 348 } |
350 } | 349 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 } | 686 } |
688 | 687 |
689 isolate_->counters()->stack_interrupts()->Increment(); | 688 isolate_->counters()->stack_interrupts()->Increment(); |
690 isolate_->counters()->runtime_profiler_ticks()->Increment(); | 689 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
691 isolate_->runtime_profiler()->OptimizeNow(); | 690 isolate_->runtime_profiler()->OptimizeNow(); |
692 | 691 |
693 return isolate_->heap()->undefined_value(); | 692 return isolate_->heap()->undefined_value(); |
694 } | 693 } |
695 | 694 |
696 } } // namespace v8::internal | 695 } } // namespace v8::internal |
OLD | NEW |