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

Side by Side Diff: src/factory.cc

Issue 7925: Addressing Ivan's comments of using INVALID_TYPE in Factory::CreateApiFunctio... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 int internal_field_count = 0; 678 int internal_field_count = 0;
679 if (!obj->instance_template()->IsUndefined()) { 679 if (!obj->instance_template()->IsUndefined()) {
680 Handle<ObjectTemplateInfo> instance_template = 680 Handle<ObjectTemplateInfo> instance_template =
681 Handle<ObjectTemplateInfo>( 681 Handle<ObjectTemplateInfo>(
682 ObjectTemplateInfo::cast(obj->instance_template())); 682 ObjectTemplateInfo::cast(obj->instance_template()));
683 internal_field_count = 683 internal_field_count =
684 Smi::cast(instance_template->internal_field_count())->value(); 684 Smi::cast(instance_template->internal_field_count())->value();
685 } 685 }
686 686
687 int instance_size = kPointerSize * internal_field_count; 687 int instance_size = kPointerSize * internal_field_count;
688 InstanceType type = JS_OBJECT_TYPE; // initialize to a valid value 688 InstanceType type = INVALID_TYPE;
689 switch (instance_type) { 689 switch (instance_type) {
690 case JavaScriptObject: 690 case JavaScriptObject:
691 type = JS_OBJECT_TYPE; 691 type = JS_OBJECT_TYPE;
692 instance_size += JSObject::kHeaderSize; 692 instance_size += JSObject::kHeaderSize;
693 break; 693 break;
694 case InnerGlobalObject: 694 case InnerGlobalObject:
695 type = JS_GLOBAL_OBJECT_TYPE; 695 type = JS_GLOBAL_OBJECT_TYPE;
696 instance_size += JSGlobalObject::kSize; 696 instance_size += JSGlobalObject::kSize;
697 break; 697 break;
698 case OuterGlobalObject: 698 case OuterGlobalObject:
699 type = JS_GLOBAL_PROXY_TYPE; 699 type = JS_GLOBAL_PROXY_TYPE;
700 instance_size += JSGlobalProxy::kSize; 700 instance_size += JSGlobalProxy::kSize;
701 break; 701 break;
702 default: 702 default:
703 ASSERT(false);
704 break; 703 break;
705 } 704 }
705 ASSERT(type != INVALID_TYPE);
706 706
707 Handle<JSFunction> result = 707 Handle<JSFunction> result =
708 Factory::NewFunction(Factory::empty_symbol(), type, instance_size, 708 Factory::NewFunction(Factory::empty_symbol(), type, instance_size,
709 code, true); 709 code, true);
710 // Set class name. 710 // Set class name.
711 Handle<Object> class_name = Handle<Object>(obj->class_name()); 711 Handle<Object> class_name = Handle<Object>(obj->class_name());
712 if (class_name->IsString()) { 712 if (class_name->IsString()) {
713 result->shared()->set_instance_class_name(*class_name); 713 result->shared()->set_instance_class_name(*class_name);
714 result->shared()->set_name(*class_name); 714 result->shared()->set_name(*class_name);
715 } 715 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 Execution::ConfigureInstance(instance, 818 Execution::ConfigureInstance(instance,
819 instance_template, 819 instance_template,
820 pending_exception); 820 pending_exception);
821 } else { 821 } else {
822 *pending_exception = false; 822 *pending_exception = false;
823 } 823 }
824 } 824 }
825 825
826 826
827 } } // namespace v8::internal 827 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698