From a5ead4a421f31ee3c4f7cfa9bbefa096cce505e9 Mon Sep 17 00:00:00 2001 From: "feng@chromium.org" Date: Thu, 23 Oct 2008 22:27:16 +0000 Subject: [PATCH] Addressing Ivan's comments of using INVALID_TYPE in Factory::CreateApiFunction. 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 | 4 ++-- src/objects.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/factory.cc b/src/factory.cc index 4e5f5da3f..37d69a28c 100644 --- a/src/factory.cc +++ b/src/factory.cc @@ -685,7 +685,7 @@ Handle 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 Factory::CreateApiFunction( instance_size += JSGlobalProxy::kSize; break; default: - ASSERT(false); break; } + ASSERT(type != INVALID_TYPE); Handle result = Factory::NewFunction(Factory::empty_symbol(), type, instance_size, diff --git a/src/objects.h b/src/objects.h index c490831df..bf0a3f21d 100644 --- a/src/objects.h +++ b/src/objects.h @@ -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 -- 2.34.1