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