Addressing Ivan's comments of using INVALID_TYPE in Factory::CreateApiFunction.
authorfeng@chromium.org <feng@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 23 Oct 2008 22:27:16 +0000 (22:27 +0000)
committerfeng@chromium.org <feng@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 23 Oct 2008 22:27:16 +0000 (22:27 +0000)
Review URL: http://codereview.chromium.org/7925

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@575 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/factory.cc
src/objects.h

index 4e5f5da3f73a756abdfbf6b418e8c961f537a5f7..37d69a28c62a0452a8cd5ad8ed11a4e96278f265 100644 (file)
@@ -685,7 +685,7 @@ Handle<JSFunction> Factory::CreateApiFunction(
   }
 
   int instance_size = kPointerSize * internal_field_count;
-  InstanceType type = JS_OBJECT_TYPE;  // initialize to a valid value
+  InstanceType type = INVALID_TYPE;
   switch (instance_type) {
     case JavaScriptObject:
       type = JS_OBJECT_TYPE;
@@ -700,9 +700,9 @@ Handle<JSFunction> Factory::CreateApiFunction(
       instance_size += JSGlobalProxy::kSize;
       break;
     default:
-      ASSERT(false);
       break;
   }
+  ASSERT(type != INVALID_TYPE);
 
   Handle<JSFunction> result =
       Factory::NewFunction(Factory::empty_symbol(), type, instance_size,
index c490831df880ca53dd9f5ed0ffac53fec9c337bb..bf0a3f21dc15fd75332f8a3739485d9959936175 100644 (file)
@@ -535,6 +535,7 @@ enum InstanceType {
   // Pseudo-types
   FIRST_NONSTRING_TYPE = MAP_TYPE,
   FIRST_TYPE = 0x0,
+  INVALID_TYPE = FIRST_TYPE - 1,
   LAST_TYPE = JS_FUNCTION_TYPE,
   // Boundaries for testing the type is a JavaScript "object".  Note that
   // function objects are not counted as objects, even though they are