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

Side by Side Diff: src/factory.cc

Issue 1722003: Added ability to remove prototype from function. In this case, [[Construct]] ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Fixes according to Erik's comments Created 10 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 } 506 }
507 507
508 // Set function.prototype and give the prototype a constructor 508 // Set function.prototype and give the prototype a constructor
509 // property that refers to the function. 509 // property that refers to the function.
510 SetPrototypeProperty(function, prototype); 510 SetPrototypeProperty(function, prototype);
511 SetProperty(prototype, Factory::constructor_symbol(), function, DONT_ENUM); 511 SetProperty(prototype, Factory::constructor_symbol(), function, DONT_ENUM);
512 return function; 512 return function;
513 } 513 }
514 514
515 515
516 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
517 Handle<Code> code) {
518 Handle<JSFunction> function = NewFunctionWithoutPrototype(name);
519 function->set_code(*code);
520 ASSERT(!function->has_initial_map());
521 ASSERT(!function->has_prototype());
522 return function;
523 }
524
525
516 Handle<Code> Factory::NewCode(const CodeDesc& desc, 526 Handle<Code> Factory::NewCode(const CodeDesc& desc,
517 ZoneScopeInfo* sinfo, 527 ZoneScopeInfo* sinfo,
518 Code::Flags flags, 528 Code::Flags flags,
519 Handle<Object> self_ref) { 529 Handle<Object> self_ref) {
520 CALL_HEAP_FUNCTION(Heap::CreateCode(desc, sinfo, flags, self_ref), Code); 530 CALL_HEAP_FUNCTION(Heap::CreateCode(desc, sinfo, flags, self_ref), Code);
521 } 531 }
522 532
523 533
524 Handle<Code> Factory::CopyCode(Handle<Code> code) { 534 Handle<Code> Factory::CopyCode(Handle<Code> code) {
525 CALL_HEAP_FUNCTION(Heap::CopyCode(*code), Code); 535 CALL_HEAP_FUNCTION(Heap::CopyCode(*code), Code);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 708
699 709
700 Handle<JSFunction> Factory::NewFunction(Handle<String> name, 710 Handle<JSFunction> Factory::NewFunction(Handle<String> name,
701 Handle<Object> prototype) { 711 Handle<Object> prototype) {
702 Handle<JSFunction> fun = NewFunctionHelper(name, prototype); 712 Handle<JSFunction> fun = NewFunctionHelper(name, prototype);
703 fun->set_context(Top::context()->global_context()); 713 fun->set_context(Top::context()->global_context());
704 return fun; 714 return fun;
705 } 715 }
706 716
707 717
718 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper(
719 Handle<String> name) {
720 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
721 CALL_HEAP_FUNCTION(Heap::AllocateFunction(
722 *Top::function_without_prototype_map(),
723 *function_share,
724 *the_hole_value()),
725 JSFunction);
726 }
727
728
729 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name) {
730 Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name);
731 fun->set_context(Top::context()->global_context());
732 return fun;
733 }
734
735
708 Handle<Object> Factory::ToObject(Handle<Object> object) { 736 Handle<Object> Factory::ToObject(Handle<Object> object) {
709 CALL_HEAP_FUNCTION(object->ToObject(), Object); 737 CALL_HEAP_FUNCTION(object->ToObject(), Object);
710 } 738 }
711 739
712 740
713 Handle<Object> Factory::ToObject(Handle<Object> object, 741 Handle<Object> Factory::ToObject(Handle<Object> object,
714 Handle<Context> global_context) { 742 Handle<Context> global_context) {
715 CALL_HEAP_FUNCTION(object->ToObject(*global_context), Object); 743 CALL_HEAP_FUNCTION(object->ToObject(*global_context), Object);
716 } 744 }
717 745
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 Execution::ConfigureInstance(instance, 972 Execution::ConfigureInstance(instance,
945 instance_template, 973 instance_template,
946 pending_exception); 974 pending_exception);
947 } else { 975 } else {
948 *pending_exception = false; 976 *pending_exception = false;
949 } 977 }
950 } 978 }
951 979
952 980
953 } } // namespace v8::internal 981 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698