OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/api-natives.h" | 5 #include "src/api-natives.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/isolate-inl.h" | 8 #include "src/isolate-inl.h" |
9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 InstantiateFunction( | 430 InstantiateFunction( |
431 isolate, handle(FunctionTemplateInfo::cast(parent), isolate)), | 431 isolate, handle(FunctionTemplateInfo::cast(parent), isolate)), |
432 JSFunction); | 432 JSFunction); |
433 // TODO(dcarney): decide what to do here. | 433 // TODO(dcarney): decide what to do here. |
434 Handle<Object> parent_prototype; | 434 Handle<Object> parent_prototype; |
435 ASSIGN_RETURN_ON_EXCEPTION( | 435 ASSIGN_RETURN_ON_EXCEPTION( |
436 isolate, parent_prototype, | 436 isolate, parent_prototype, |
437 JSObject::GetProperty(parent_instance, | 437 JSObject::GetProperty(parent_instance, |
438 isolate->factory()->prototype_string()), | 438 isolate->factory()->prototype_string()), |
439 JSFunction); | 439 JSFunction); |
440 MAYBE_RETURN(JSObject::SetPrototype(prototype, parent_prototype, false, | 440 JSObject::ForceSetPrototype(prototype, parent_prototype); |
441 Object::THROW_ON_ERROR), | |
442 MaybeHandle<JSFunction>()); | |
443 } | 441 } |
444 } | 442 } |
445 Handle<JSFunction> function = ApiNatives::CreateApiFunction( | 443 Handle<JSFunction> function = ApiNatives::CreateApiFunction( |
446 isolate, data, prototype, ApiNatives::JavaScriptObjectType); | 444 isolate, data, prototype, ApiNatives::JavaScriptObjectType); |
447 if (!name.is_null() && name->IsString()) { | 445 if (!name.is_null() && name->IsString()) { |
448 function->shared()->set_name(*name); | 446 function->shared()->set_name(*name); |
449 } | 447 } |
450 if (serial_number) { | 448 if (serial_number) { |
451 // Cache the function. | 449 // Cache the function. |
452 CacheTemplateInstantiation(isolate, serial_number, function); | 450 CacheTemplateInstantiation(isolate, serial_number, function); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 if (!obj->instance_call_handler()->IsUndefined(isolate)) { | 674 if (!obj->instance_call_handler()->IsUndefined(isolate)) { |
677 map->set_is_callable(); | 675 map->set_is_callable(); |
678 map->set_is_constructor(true); | 676 map->set_is_constructor(true); |
679 } | 677 } |
680 | 678 |
681 return result; | 679 return result; |
682 } | 680 } |
683 | 681 |
684 } // namespace internal | 682 } // namespace internal |
685 } // namespace v8 | 683 } // namespace v8 |
OLD | NEW |