Fix SConstruct to pass correct defines to samples/preparser when building with librar...
authorvegorov@chromium.org <vegorov@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 30 Jun 2011 11:53:54 +0000 (11:53 +0000)
committervegorov@chromium.org <vegorov@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 30 Jun 2011 11:53:54 +0000 (11:53 +0000)
Fix shell sample build with library=library.

R=ager@chromium.org

Review URL: http://codereview.chromium.org/7283039

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

SConstruct
samples/shell.cc

index 95dfd9e..e678bd4 100644 (file)
@@ -400,6 +400,9 @@ DTOA_EXTRA_FLAGS = {
 CCTEST_EXTRA_FLAGS = {
   'all': {
     'CPPPATH': [join(root_dir, 'src')],
+    'library:shared': {
+      'CPPDEFINES': ['USING_V8_SHARED']
+    },
   },
   'gcc': {
     'all': {
@@ -436,9 +439,6 @@ CCTEST_EXTRA_FLAGS = {
       'CPPDEFINES': ['_HAS_EXCEPTIONS=0'],
       'LIBS': ['winmm', 'ws2_32']
     },
-    'library:shared': {
-      'CPPDEFINES': ['USING_V8_SHARED']
-    },
     'arch:ia32': {
       'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
     },
@@ -453,6 +453,9 @@ CCTEST_EXTRA_FLAGS = {
 SAMPLE_FLAGS = {
   'all': {
     'CPPPATH': [join(abspath('.'), 'include')],
+    'library:shared': {
+      'CPPDEFINES': ['USING_V8_SHARED']
+    },
   },
   'gcc': {
     'all': {
@@ -572,9 +575,6 @@ SAMPLE_FLAGS = {
     'verbose:on': {
       'LINKFLAGS': ['/VERBOSE']
     },
-    'library:shared': {
-      'CPPDEFINES': ['USING_V8_SHARED']
-    },
     'prof:on': {
       'LINKFLAGS': ['/MAP']
     },
@@ -625,7 +625,10 @@ SAMPLE_FLAGS = {
 
 PREPARSER_FLAGS = {
   'all': {
-    'CPPPATH': [join(abspath('.'), 'include'), join(abspath('.'), 'src')]
+    'CPPPATH': [join(abspath('.'), 'include'), join(abspath('.'), 'src')],
+    'library:shared': {
+      'CPPDEFINES': ['USING_V8_SHARED']
+    },
   },
   'gcc': {
     'all': {
@@ -727,9 +730,6 @@ PREPARSER_FLAGS = {
     'verbose:on': {
       'LINKFLAGS': ['/VERBOSE']
     },
-    'library:shared': {
-      'CPPDEFINES': ['USING_V8_SHARED']
-    },
     'prof:on': {
       'LINKFLAGS': ['/MAP']
     },
index 15c1a5a..7c30bec 100644 (file)
@@ -498,12 +498,15 @@ void ExternalArrayWeakCallback(v8::Persistent<v8::Value> object, void* data) {
 v8::Handle<v8::Value> CreateExternalArray(const v8::Arguments& args,
                                           v8::ExternalArrayType type,
                                           size_t element_size) {
-  ASSERT(element_size == 1 || element_size == 2 || element_size == 4 ||
+  assert(element_size == 1 ||
+         element_size == 2 ||
+         element_size == 4 ||
          element_size == 8);
   if (args.Length() != 1) {
     return v8::ThrowException(
         v8::String::New("Array constructor needs one parameter."));
   }
+  static const int kMaxLength = 0x3fffffff;
   size_t length = 0;
   if (args[0]->IsUint32()) {
     length = args[0]->Uint32Value();
@@ -513,7 +516,7 @@ v8::Handle<v8::Value> CreateExternalArray(const v8::Arguments& args,
       return v8::ThrowException(
           v8::String::New("Array length must not be negative."));
     }
-    if (raw_length > v8::internal::ExternalArray::kMaxLength) {
+    if (raw_length > kMaxLength) {
       return v8::ThrowException(
           v8::String::New("Array length exceeds maximum length."));
     }
@@ -522,7 +525,7 @@ v8::Handle<v8::Value> CreateExternalArray(const v8::Arguments& args,
     return v8::ThrowException(
         v8::String::New("Array length must be a number."));
   }
-  if (length > static_cast<size_t>(v8::internal::ExternalArray::kMaxLength)) {
+  if (length > static_cast<size_t>(kMaxLength)) {
     return v8::ThrowException(
         v8::String::New("Array length exceeds maximum length."));
   }