Revision: 23539
Author: [email protected]
Date: Mon Sep 1 00:05:43 2014 UTC
Log: Version 3.29.35 (based on bleeding_edge revision r23537)
Performance and stability improvements on all platforms.
https://code.google.com/p/v8/source/detail?r=23539
Added:
/trunk/src/arm/interface-descriptors-arm.cc
/trunk/src/arm/interface-descriptors-arm.h
/trunk/src/arm64/interface-descriptors-arm64.cc
/trunk/src/arm64/interface-descriptors-arm64.h
/trunk/src/base/base.gyp
/trunk/src/base/bits-unittest.cc
/trunk/src/base/cpu-unittest.cc
/trunk/src/base/flags-unittest.cc
/trunk/src/base/platform/condition-variable-unittest.cc
/trunk/src/base/platform/mutex-unittest.cc
/trunk/src/base/platform/platform-unittest.cc
/trunk/src/base/platform/semaphore-unittest.cc
/trunk/src/base/platform/time-unittest.cc
/trunk/src/base/sys-info-unittest.cc
/trunk/src/base/utils/random-number-generator-unittest.cc
/trunk/src/ia32/interface-descriptors-ia32.cc
/trunk/src/interface-descriptors.cc
/trunk/src/interface-descriptors.h
/trunk/src/mips/interface-descriptors-mips.cc
/trunk/src/mips64/interface-descriptors-mips64.cc
/trunk/src/x64/interface-descriptors-x64.cc
Deleted:
/trunk/test/base-unittests/DEPS
/trunk/test/base-unittests/base-unittests.gyp
/trunk/test/base-unittests/bits-unittest.cc
/trunk/test/base-unittests/cpu-unittest.cc
/trunk/test/base-unittests/flags-unittest.cc
/trunk/test/base-unittests/platform/condition-variable-unittest.cc
/trunk/test/base-unittests/platform/mutex-unittest.cc
/trunk/test/base-unittests/platform/platform-unittest.cc
/trunk/test/base-unittests/platform/semaphore-unittest.cc
/trunk/test/base-unittests/platform/time-unittest.cc
/trunk/test/base-unittests/sys-info-unittest.cc
/trunk/test/base-unittests/utils/random-number-generator-unittest.cc
Modified:
/trunk/BUILD.gn
/trunk/ChangeLog
/trunk/build/all.gyp
/trunk/src/DEPS
/trunk/src/arm/code-stubs-arm.cc
/trunk/src/arm/code-stubs-arm.h
/trunk/src/arm64/code-stubs-arm64.cc
/trunk/src/arm64/code-stubs-arm64.h
/trunk/src/arm64/decoder-arm64.cc
/trunk/src/arm64/macro-assembler-arm64.cc
/trunk/src/base/platform/platform-linux.cc
/trunk/src/base/platform/platform-posix.cc
/trunk/src/base/platform/semaphore.cc
/trunk/src/base/sys-info.cc
/trunk/src/code-stubs.cc
/trunk/src/code-stubs.h
/trunk/src/compiler/arm/code-generator-arm.cc
/trunk/src/compiler/arm/instruction-selector-arm.cc
/trunk/src/compiler/arm/linkage-arm.cc
/trunk/src/compiler/arm64/code-generator-arm64.cc
/trunk/src/compiler/arm64/instruction-selector-arm64.cc
/trunk/src/compiler/arm64/linkage-arm64.cc
/trunk/src/compiler/change-lowering.cc
/trunk/src/compiler/change-lowering.h
/trunk/src/compiler/code-generator.cc
/trunk/src/compiler/generic-node-inl.h
/trunk/src/compiler/ia32/code-generator-ia32.cc
/trunk/src/compiler/ia32/instruction-selector-ia32.cc
/trunk/src/compiler/ia32/linkage-ia32.cc
/trunk/src/compiler/js-generic-lowering.cc
/trunk/src/compiler/js-generic-lowering.h
/trunk/src/compiler/linkage-impl.h
/trunk/src/compiler/linkage.cc
/trunk/src/compiler/linkage.h
/trunk/src/compiler/raw-machine-assembler.cc
/trunk/src/compiler/x64/code-generator-x64.cc
/trunk/src/compiler/x64/instruction-selector-x64.cc
/trunk/src/compiler/x64/linkage-x64.cc
/trunk/src/d8-posix.cc
/trunk/src/hydrogen.cc
/trunk/src/ia32/code-stubs-ia32.cc
/trunk/src/isolate.cc
/trunk/src/isolate.h
/trunk/src/lithium-allocator.cc
/trunk/src/lithium-allocator.h
/trunk/src/math.js
/trunk/src/mips/code-stubs-mips.cc
/trunk/src/mips64/code-stubs-mips64.cc
/trunk/src/sampler.cc
/trunk/src/version.cc
/trunk/src/x64/code-stubs-x64.cc
/trunk/test/cctest/cctest.status
/trunk/test/cctest/compiler/test-changes-lowering.cc
/trunk/test/cctest/compiler/test-node.cc
/trunk/test/cctest/compiler/test-run-inlining.cc
/trunk/test/cctest/compiler/test-run-properties.cc
/trunk/test/cctest/test-api.cc
/trunk/test/mjsunit/es6/math-hyperbolic.js
/trunk/third_party/fdlibm/fdlibm.cc
/trunk/third_party/fdlibm/fdlibm.h
/trunk/third_party/fdlibm/fdlibm.js
/trunk/tools/generate-runtime-tests.py
/trunk/tools/gyp/v8.gyp
=======================================
--- /dev/null
+++ /trunk/src/arm/interface-descriptors-arm.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,108 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#if V8_TARGET_ARCH_ARM
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+const Register InterfaceDescriptor::ContextRegister() { return cp; }
+
+
+void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
+ static PlatformInterfaceDescriptor default_descriptor =
+ PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
+
+ static PlatformInterfaceDescriptor noInlineDescriptor =
+ PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
+
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall);
+ Register registers[] = {
+ cp, // context
+ r1, // JSFunction
+ r0, // actual number of arguments
+ r2, // expected number of arguments
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // JSFunction
+ Representation::Integer32(), // actual number of arguments
+ Representation::Integer32(), // expected number of arguments
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &default_descriptor);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::KeyedCall);
+ Register registers[] = {
+ cp, // context
+ r2, // key
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // key
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &noInlineDescriptor);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::NamedCall);
+ Register registers[] = {
+ cp, // context
+ r2, // name
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // name
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &noInlineDescriptor);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::CallHandler);
+ Register registers[] = {
+ cp, // context
+ r0, // receiver
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &default_descriptor);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ApiFunctionCall);
+ Register registers[] = {
+ cp, // context
+ r0, // callee
+ r4, // call_data
+ r2, // holder
+ r1, // api_function_address
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // callee
+ Representation::Tagged(), // call_data
+ Representation::Tagged(), // holder
+ Representation::External(), // api_function_address
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &default_descriptor);
+ }
+}
+}
+} // namespace v8::internal
+
+#endif // V8_TARGET_ARCH_ARM
=======================================
--- /dev/null
+++ /trunk/src/arm/interface-descriptors-arm.h Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,26 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_ARM_INTERFACE_DESCRIPTORS_ARM_H_
+#define V8_ARM_INTERFACE_DESCRIPTORS_ARM_H_
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+class PlatformInterfaceDescriptor {
+ public:
+ explicit PlatformInterfaceDescriptor(TargetAddressStorageMode
storage_mode)
+ : storage_mode_(storage_mode) {}
+
+ TargetAddressStorageMode storage_mode() { return storage_mode_; }
+
+ private:
+ TargetAddressStorageMode storage_mode_;
+};
+}
+} // namespace v8::internal
+
+#endif // V8_ARM_INTERFACE_DESCRIPTORS_ARM_H_
=======================================
--- /dev/null
+++ /trunk/src/arm64/interface-descriptors-arm64.cc Mon Sep 1 00:05:43
2014 UTC
@@ -0,0 +1,108 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#if V8_TARGET_ARCH_ARM64
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+const Register InterfaceDescriptor::ContextRegister() { return cp; }
+
+
+void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
+ static PlatformInterfaceDescriptor default_descriptor =
+ PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
+
+ static PlatformInterfaceDescriptor noInlineDescriptor =
+ PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
+
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall);
+ Register registers[] = {
+ cp, // context
+ x1, // JSFunction
+ x0, // actual number of arguments
+ x2, // expected number of arguments
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // JSFunction
+ Representation::Integer32(), // actual number of arguments
+ Representation::Integer32(), // expected number of arguments
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &default_descriptor);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::KeyedCall);
+ Register registers[] = {
+ cp, // context
+ x2, // key
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // key
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &noInlineDescriptor);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::NamedCall);
+ Register registers[] = {
+ cp, // context
+ x2, // name
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // name
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &noInlineDescriptor);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::CallHandler);
+ Register registers[] = {
+ cp, // context
+ x0, // receiver
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &default_descriptor);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ApiFunctionCall);
+ Register registers[] = {
+ cp, // context
+ x0, // callee
+ x4, // call_data
+ x2, // holder
+ x1, // api_function_address
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // callee
+ Representation::Tagged(), // call_data
+ Representation::Tagged(), // holder
+ Representation::External(), // api_function_address
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations,
+ &default_descriptor);
+ }
+}
+}
+} // namespace v8::internal
+
+#endif // V8_TARGET_ARCH_ARM64
=======================================
--- /dev/null
+++ /trunk/src/arm64/interface-descriptors-arm64.h Mon Sep 1 00:05:43 2014
UTC
@@ -0,0 +1,26 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_ARM64_INTERFACE_DESCRIPTORS_ARM64_H_
+#define V8_ARM64_INTERFACE_DESCRIPTORS_ARM64_H_
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+class PlatformInterfaceDescriptor {
+ public:
+ explicit PlatformInterfaceDescriptor(TargetAddressStorageMode
storage_mode)
+ : storage_mode_(storage_mode) {}
+
+ TargetAddressStorageMode storage_mode() { return storage_mode_; }
+
+ private:
+ TargetAddressStorageMode storage_mode_;
+};
+}
+} // namespace v8::internal
+
+#endif // V8_ARM64_INTERFACE_DESCRIPTORS_ARM64_H_
=======================================
--- /dev/null
+++ /trunk/src/base/base.gyp Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,45 @@
+# Copyright 2014 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'v8_code': 1,
+ },
+ 'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'],
+ 'targets': [
+ {
+ 'target_name': 'base-unittests',
+ 'type': 'executable',
+ 'dependencies': [
+ '../../testing/gtest.gyp:gtest',
+ '../../testing/gtest.gyp:gtest_main',
+ '../../tools/gyp/v8.gyp:v8_libbase',
+ ],
+ 'include_dirs': [
+ '../..',
+ ],
+ 'sources': [ ### gcmole(all) ###
+ 'bits-unittest.cc',
+ 'cpu-unittest.cc',
+ 'flags-unittest.cc',
+ 'platform/condition-variable-unittest.cc',
+ 'platform/mutex-unittest.cc',
+ 'platform/platform-unittest.cc',
+ 'platform/semaphore-unittest.cc',
+ 'platform/time-unittest.cc',
+ 'sys-info-unittest.cc',
+ 'utils/random-number-generator-unittest.cc',
+ ],
+ 'conditions': [
+ ['os_posix == 1', {
+ # TODO(svenpanne): This is a temporary work-around to fix the
warnings
+ # that show up because we use -std=gnu++0x instead of -std=c++11.
+ 'cflags!': [
+ '-pedantic',
+ ],
+ }],
+ ],
+ },
+ ],
+}
=======================================
--- /dev/null
+++ /trunk/src/base/bits-unittest.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,64 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/bits.h"
+#include "src/base/macros.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace base {
+namespace bits {
+
+TEST(BitsTest, CountPopulation32) {
+ EXPECT_EQ(0u, CountPopulation32(0));
+ EXPECT_EQ(1u, CountPopulation32(1));
+ EXPECT_EQ(8u, CountPopulation32(0x11111111));
+ EXPECT_EQ(16u, CountPopulation32(0xf0f0f0f0));
+ EXPECT_EQ(24u, CountPopulation32(0xfff0f0ff));
+ EXPECT_EQ(32u, CountPopulation32(0xffffffff));
+}
+
+
+TEST(BitsTest, CountLeadingZeros32) {
+ EXPECT_EQ(32u, CountLeadingZeros32(0));
+ EXPECT_EQ(31u, CountLeadingZeros32(1));
+ TRACED_FORRANGE(uint32_t, shift, 0, 31) {
+ EXPECT_EQ(31u - shift, CountLeadingZeros32(1u << shift));
+ }
+ EXPECT_EQ(4u, CountLeadingZeros32(0x0f0f0f0f));
+}
+
+
+TEST(BitsTest, CountTrailingZeros32) {
+ EXPECT_EQ(32u, CountTrailingZeros32(0));
+ EXPECT_EQ(31u, CountTrailingZeros32(0x80000000));
+ TRACED_FORRANGE(uint32_t, shift, 0, 31) {
+ EXPECT_EQ(shift, CountTrailingZeros32(1u << shift));
+ }
+ EXPECT_EQ(4u, CountTrailingZeros32(0xf0f0f0f0));
+}
+
+
+TEST(BitsTest, RotateRight32) {
+ TRACED_FORRANGE(uint32_t, shift, 0, 31) {
+ EXPECT_EQ(0u, RotateRight32(0u, shift));
+ }
+ EXPECT_EQ(1u, RotateRight32(1, 0));
+ EXPECT_EQ(1u, RotateRight32(2, 1));
+ EXPECT_EQ(0x80000000u, RotateRight32(1, 1));
+}
+
+
+TEST(BitsTest, RotateRight64) {
+ TRACED_FORRANGE(uint64_t, shift, 0, 63) {
+ EXPECT_EQ(0u, RotateRight64(0u, shift));
+ }
+ EXPECT_EQ(1u, RotateRight64(1, 0));
+ EXPECT_EQ(1u, RotateRight64(2, 1));
+ EXPECT_EQ(V8_UINT64_C(0x8000000000000000), RotateRight64(1, 1));
+}
+
+} // namespace bits
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/cpu-unittest.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,49 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/cpu.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace base {
+
+TEST(CPUTest, FeatureImplications) {
+ CPU cpu;
+
+ // ia32 and x64 features
+ EXPECT_TRUE(!cpu.has_sse() || cpu.has_mmx());
+ EXPECT_TRUE(!cpu.has_sse2() || cpu.has_sse());
+ EXPECT_TRUE(!cpu.has_sse3() || cpu.has_sse2());
+ EXPECT_TRUE(!cpu.has_ssse3() || cpu.has_sse3());
+ EXPECT_TRUE(!cpu.has_sse41() || cpu.has_sse3());
+ EXPECT_TRUE(!cpu.has_sse42() || cpu.has_sse41());
+
+ // arm features
+ EXPECT_TRUE(!cpu.has_vfp3_d32() || cpu.has_vfp3());
+}
+
+
+TEST(CPUTest, RequiredFeatures) {
+ CPU cpu;
+
+#if V8_HOST_ARCH_ARM
+ EXPECT_TRUE(cpu.has_fpu());
+#endif
+
+#if V8_HOST_ARCH_IA32
+ EXPECT_TRUE(cpu.has_fpu());
+ EXPECT_TRUE(cpu.has_sahf());
+#endif
+
+#if V8_HOST_ARCH_X64
+ EXPECT_TRUE(cpu.has_fpu());
+ EXPECT_TRUE(cpu.has_cmov());
+ EXPECT_TRUE(cpu.has_mmx());
+ EXPECT_TRUE(cpu.has_sse());
+ EXPECT_TRUE(cpu.has_sse2());
+#endif
+}
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/flags-unittest.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,103 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/flags.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace base {
+
+namespace {
+
+enum Flag1 {
+ kFlag1None = 0,
+ kFlag1First = 1u << 1,
+ kFlag1Second = 1u << 2,
+ kFlag1All = kFlag1None | kFlag1First | kFlag1Second
+};
+DEFINE_FLAGS(Flags1, Flag1);
+
+
+DEFINE_OPERATORS_FOR_FLAGS(Flags1)
+
+
+Flags1 bar(Flags1 flags1) { return flags1; }
+
+} // namespace
+
+
+TEST(FlagsTest, BasicOperations) {
+ Flags1 a;
+ EXPECT_EQ(kFlag1None, static_cast<int>(a));
+ a |= kFlag1First;
+ EXPECT_EQ(kFlag1First, static_cast<int>(a));
+ a = a | kFlag1Second;
+ EXPECT_EQ(kFlag1All, static_cast<int>(a));
+ a &= kFlag1Second;
+ EXPECT_EQ(kFlag1Second, static_cast<int>(a));
+ a = kFlag1None & a;
+ EXPECT_EQ(kFlag1None, static_cast<int>(a));
+ a ^= (kFlag1All | kFlag1None);
+ EXPECT_EQ(kFlag1All, static_cast<int>(a));
+ Flags1 b = ~a;
+ EXPECT_EQ(kFlag1All, static_cast<int>(a));
+ EXPECT_EQ(~static_cast<int>(a), static_cast<int>(b));
+ Flags1 c = a;
+ EXPECT_EQ(a, c);
+ EXPECT_NE(a, b);
+ EXPECT_EQ(a, bar(a));
+ EXPECT_EQ(a, bar(kFlag1All));
+}
+
+
+namespace {
+namespace foo {
+
+enum Option {
+ kNoOptions = 0,
+ kOption1 = 1,
+ kOption2 = 2,
+ kAllOptions = kNoOptions | kOption1 | kOption2
+};
+DEFINE_FLAGS(Options, Option);
+
+} // namespace foo
+
+
+DEFINE_OPERATORS_FOR_FLAGS(foo::Options)
+
+} // namespace
+
+
+TEST(FlagsTest, NamespaceScope) {
+ foo::Options options;
+ options ^= foo::kNoOptions;
+ options |= foo::kOption1 | foo::kOption2;
+ EXPECT_EQ(foo::kAllOptions, static_cast<int>(options));
+}
+
+
+namespace {
+
+struct Foo {
+ enum Enum { kEnum1 = 1, kEnum2 = 2 };
+ DEFINE_FLAGS(Enums, Enum);
+};
+
+
+DEFINE_OPERATORS_FOR_FLAGS(Foo::Enums)
+
+} // namespace
+
+
+TEST(FlagsTest, ClassScope) {
+ Foo::Enums enums;
+ enums |= Foo::kEnum1;
+ enums |= Foo::kEnum2;
+ EXPECT_TRUE(enums & Foo::kEnum1);
+ EXPECT_TRUE(enums & Foo::kEnum2);
+}
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/platform/condition-variable-unittest.cc Mon Sep 1
00:05:43 2014 UTC
@@ -0,0 +1,301 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/platform/condition-variable.h"
+
+#include "src/base/platform/platform.h"
+#include "src/base/platform/time.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace base {
+
+TEST(ConditionVariable, WaitForAfterNofityOnSameThread) {
+ for (int n = 0; n < 10; ++n) {
+ Mutex mutex;
+ ConditionVariable cv;
+
+ LockGuard<Mutex> lock_guard(&mutex);
+
+ cv.NotifyOne();
+ EXPECT_FALSE(cv.WaitFor(&mutex, TimeDelta::FromMicroseconds(n)));
+
+ cv.NotifyAll();
+ EXPECT_FALSE(cv.WaitFor(&mutex, TimeDelta::FromMicroseconds(n)));
+ }
+}
+
+
+namespace {
+
+class ThreadWithMutexAndConditionVariable V8_FINAL : public Thread {
+ public:
+ ThreadWithMutexAndConditionVariable()
+ : Thread(Options("ThreadWithMutexAndConditionVariable")),
+ running_(false),
+ finished_(false) {}
+ virtual ~ThreadWithMutexAndConditionVariable() {}
+
+ virtual void Run() V8_OVERRIDE {
+ LockGuard<Mutex> lock_guard(&mutex_);
+ running_ = true;
+ cv_.NotifyOne();
+ while (running_) {
+ cv_.Wait(&mutex_);
+ }
+ finished_ = true;
+ cv_.NotifyAll();
+ }
+
+ bool running_;
+ bool finished_;
+ ConditionVariable cv_;
+ Mutex mutex_;
+};
+
+} // namespace
+
+
+TEST(ConditionVariable, MultipleThreadsWithSeparateConditionVariables) {
+ static const int kThreadCount = 128;
+ ThreadWithMutexAndConditionVariable threads[kThreadCount];
+
+ for (int n = 0; n < kThreadCount; ++n) {
+ LockGuard<Mutex> lock_guard(&threads[n].mutex_);
+ EXPECT_FALSE(threads[n].running_);
+ EXPECT_FALSE(threads[n].finished_);
+ threads[n].Start();
+ // Wait for nth thread to start.
+ while (!threads[n].running_) {
+ threads[n].cv_.Wait(&threads[n].mutex_);
+ }
+ }
+
+ for (int n = kThreadCount - 1; n >= 0; --n) {
+ LockGuard<Mutex> lock_guard(&threads[n].mutex_);
+ EXPECT_TRUE(threads[n].running_);
+ EXPECT_FALSE(threads[n].finished_);
+ }
+
+ for (int n = 0; n < kThreadCount; ++n) {
+ LockGuard<Mutex> lock_guard(&threads[n].mutex_);
+ EXPECT_TRUE(threads[n].running_);
+ EXPECT_FALSE(threads[n].finished_);
+ // Tell the nth thread to quit.
+ threads[n].running_ = false;
+ threads[n].cv_.NotifyOne();
+ }
+
+ for (int n = kThreadCount - 1; n >= 0; --n) {
+ // Wait for nth thread to quit.
+ LockGuard<Mutex> lock_guard(&threads[n].mutex_);
+ while (!threads[n].finished_) {
+ threads[n].cv_.Wait(&threads[n].mutex_);
+ }
+ EXPECT_FALSE(threads[n].running_);
+ EXPECT_TRUE(threads[n].finished_);
+ }
+
+ for (int n = 0; n < kThreadCount; ++n) {
+ threads[n].Join();
+ LockGuard<Mutex> lock_guard(&threads[n].mutex_);
+ EXPECT_FALSE(threads[n].running_);
+ EXPECT_TRUE(threads[n].finished_);
+ }
+}
+
+
+namespace {
+
+class ThreadWithSharedMutexAndConditionVariable V8_FINAL : public Thread {
+ public:
+ ThreadWithSharedMutexAndConditionVariable()
+ : Thread(Options("ThreadWithSharedMutexAndConditionVariable")),
+ running_(false),
+ finished_(false),
+ cv_(NULL),
+ mutex_(NULL) {}
+ virtual ~ThreadWithSharedMutexAndConditionVariable() {}
+
+ virtual void Run() V8_OVERRIDE {
+ LockGuard<Mutex> lock_guard(mutex_);
+ running_ = true;
+ cv_->NotifyAll();
+ while (running_) {
+ cv_->Wait(mutex_);
+ }
+ finished_ = true;
+ cv_->NotifyAll();
+ }
+
+ bool running_;
+ bool finished_;
+ ConditionVariable* cv_;
+ Mutex* mutex_;
+};
+
+} // namespace
+
+
+TEST(ConditionVariable,
MultipleThreadsWithSharedSeparateConditionVariables) {
+ static const int kThreadCount = 128;
+ ThreadWithSharedMutexAndConditionVariable threads[kThreadCount];
+ ConditionVariable cv;
+ Mutex mutex;
+
+ for (int n = 0; n < kThreadCount; ++n) {
+ threads[n].mutex_ = &mutex;
+ threads[n].cv_ = &cv;
+ }
+
+ // Start all threads.
+ {
+ LockGuard<Mutex> lock_guard(&mutex);
+ for (int n = 0; n < kThreadCount; ++n) {
+ EXPECT_FALSE(threads[n].running_);
+ EXPECT_FALSE(threads[n].finished_);
+ threads[n].Start();
+ }
+ }
+
+ // Wait for all threads to start.
+ {
+ LockGuard<Mutex> lock_guard(&mutex);
+ for (int n = kThreadCount - 1; n >= 0; --n) {
+ while (!threads[n].running_) {
+ cv.Wait(&mutex);
+ }
+ }
+ }
+
+ // Make sure that all threads are running.
+ {
+ LockGuard<Mutex> lock_guard(&mutex);
+ for (int n = 0; n < kThreadCount; ++n) {
+ EXPECT_TRUE(threads[n].running_);
+ EXPECT_FALSE(threads[n].finished_);
+ }
+ }
+
+ // Tell all threads to quit.
+ {
+ LockGuard<Mutex> lock_guard(&mutex);
+ for (int n = kThreadCount - 1; n >= 0; --n) {
+ EXPECT_TRUE(threads[n].running_);
+ EXPECT_FALSE(threads[n].finished_);
+ // Tell the nth thread to quit.
+ threads[n].running_ = false;
+ }
+ cv.NotifyAll();
+ }
+
+ // Wait for all threads to quit.
+ {
+ LockGuard<Mutex> lock_guard(&mutex);
+ for (int n = 0; n < kThreadCount; ++n) {
+ while (!threads[n].finished_) {
+ cv.Wait(&mutex);
+ }
+ }
+ }
+
+ // Make sure all threads are finished.
+ {
+ LockGuard<Mutex> lock_guard(&mutex);
+ for (int n = kThreadCount - 1; n >= 0; --n) {
+ EXPECT_FALSE(threads[n].running_);
+ EXPECT_TRUE(threads[n].finished_);
+ }
+ }
+
+ // Join all threads.
+ for (int n = 0; n < kThreadCount; ++n) {
+ threads[n].Join();
+ }
+}
+
+
+namespace {
+
+class LoopIncrementThread V8_FINAL : public Thread {
+ public:
+ LoopIncrementThread(int rem, int* counter, int limit, int thread_count,
+ ConditionVariable* cv, Mutex* mutex)
+ : Thread(Options("LoopIncrementThread")),
+ rem_(rem),
+ counter_(counter),
+ limit_(limit),
+ thread_count_(thread_count),
+ cv_(cv),
+ mutex_(mutex) {
+ EXPECT_LT(rem, thread_count);
+ EXPECT_EQ(0, limit % thread_count);
+ }
+
+ virtual void Run() V8_OVERRIDE {
+ int last_count = -1;
+ while (true) {
+ LockGuard<Mutex> lock_guard(mutex_);
+ int count = *counter_;
+ while (count % thread_count_ != rem_ && count < limit_) {
+ cv_->Wait(mutex_);
+ count = *counter_;
+ }
+ if (count >= limit_) break;
+ EXPECT_EQ(*counter_, count);
+ if (last_count != -1) {
+ EXPECT_EQ(last_count + (thread_count_ - 1), count);
+ }
+ count++;
+ *counter_ = count;
+ last_count = count;
+ cv_->NotifyAll();
+ }
+ }
+
+ private:
+ const int rem_;
+ int* counter_;
+ const int limit_;
+ const int thread_count_;
+ ConditionVariable* cv_;
+ Mutex* mutex_;
+};
+
+} // namespace
+
+
+TEST(ConditionVariable, LoopIncrement) {
+ static const int kMaxThreadCount = 16;
+ Mutex mutex;
+ ConditionVariable cv;
+ for (int thread_count = 1; thread_count < kMaxThreadCount;
++thread_count) {
+ int limit = thread_count * 10;
+ int counter = 0;
+
+ // Setup the threads.
+ Thread** threads = new Thread* [thread_count];
+ for (int n = 0; n < thread_count; ++n) {
+ threads[n] = new LoopIncrementThread(n, &counter, limit,
thread_count,
+ &cv, &mutex);
+ }
+
+ // Start all threads.
+ for (int n = thread_count - 1; n >= 0; --n) {
+ threads[n]->Start();
+ }
+
+ // Join and cleanup all threads.
+ for (int n = 0; n < thread_count; ++n) {
+ threads[n]->Join();
+ delete threads[n];
+ }
+ delete[] threads;
+
+ EXPECT_EQ(limit, counter);
+ }
+}
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/platform/mutex-unittest.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,91 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/platform/mutex.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace base {
+
+TEST(Mutex, LockGuardMutex) {
+ Mutex mutex;
+ { LockGuard<Mutex> lock_guard(&mutex); }
+ { LockGuard<Mutex> lock_guard(&mutex); }
+}
+
+
+TEST(Mutex, LockGuardRecursiveMutex) {
+ RecursiveMutex recursive_mutex;
+ { LockGuard<RecursiveMutex> lock_guard(&recursive_mutex); }
+ {
+ LockGuard<RecursiveMutex> lock_guard1(&recursive_mutex);
+ LockGuard<RecursiveMutex> lock_guard2(&recursive_mutex);
+ }
+}
+
+
+TEST(Mutex, LockGuardLazyMutex) {
+ LazyMutex lazy_mutex = LAZY_MUTEX_INITIALIZER;
+ { LockGuard<Mutex> lock_guard(lazy_mutex.Pointer()); }
+ { LockGuard<Mutex> lock_guard(lazy_mutex.Pointer()); }
+}
+
+
+TEST(Mutex, LockGuardLazyRecursiveMutex) {
+ LazyRecursiveMutex lazy_recursive_mutex =
LAZY_RECURSIVE_MUTEX_INITIALIZER;
+ { LockGuard<RecursiveMutex> lock_guard(lazy_recursive_mutex.Pointer()); }
+ {
+ LockGuard<RecursiveMutex> lock_guard1(lazy_recursive_mutex.Pointer());
+ LockGuard<RecursiveMutex> lock_guard2(lazy_recursive_mutex.Pointer());
+ }
+}
+
+
+TEST(Mutex, MultipleMutexes) {
+ Mutex mutex1;
+ Mutex mutex2;
+ Mutex mutex3;
+ // Order 1
+ mutex1.Lock();
+ mutex2.Lock();
+ mutex3.Lock();
+ mutex1.Unlock();
+ mutex2.Unlock();
+ mutex3.Unlock();
+ // Order 2
+ mutex1.Lock();
+ mutex2.Lock();
+ mutex3.Lock();
+ mutex3.Unlock();
+ mutex2.Unlock();
+ mutex1.Unlock();
+}
+
+
+TEST(Mutex, MultipleRecursiveMutexes) {
+ RecursiveMutex recursive_mutex1;
+ RecursiveMutex recursive_mutex2;
+ // Order 1
+ recursive_mutex1.Lock();
+ recursive_mutex2.Lock();
+ EXPECT_TRUE(recursive_mutex1.TryLock());
+ EXPECT_TRUE(recursive_mutex2.TryLock());
+ recursive_mutex1.Unlock();
+ recursive_mutex1.Unlock();
+ recursive_mutex2.Unlock();
+ recursive_mutex2.Unlock();
+ // Order 2
+ recursive_mutex1.Lock();
+ EXPECT_TRUE(recursive_mutex1.TryLock());
+ recursive_mutex2.Lock();
+ EXPECT_TRUE(recursive_mutex2.TryLock());
+ recursive_mutex2.Unlock();
+ recursive_mutex1.Unlock();
+ recursive_mutex2.Unlock();
+ recursive_mutex1.Unlock();
+}
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/platform/platform-unittest.cc Mon Sep 1 00:05:43 2014
UTC
@@ -0,0 +1,110 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/platform/platform.h"
+
+#if V8_OS_POSIX
+#include <unistd.h> // NOLINT
+#endif
+
+#if V8_OS_WIN
+#include "src/base/win32-headers.h"
+#endif
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace base {
+
+TEST(OS, GetCurrentProcessId) {
+#if V8_OS_POSIX
+ EXPECT_EQ(static_cast<int>(getpid()), OS::GetCurrentProcessId());
+#endif
+
+#if V8_OS_WIN
+ EXPECT_EQ(static_cast<int>(::GetCurrentProcessId()),
+ OS::GetCurrentProcessId());
+#endif
+}
+
+
+namespace {
+
+class SelfJoinThread V8_FINAL : public Thread {
+ public:
+ SelfJoinThread() : Thread(Options("SelfJoinThread")) {}
+ virtual void Run() V8_OVERRIDE { Join(); }
+};
+
+} // namespace
+
+
+TEST(Thread, SelfJoin) {
+ SelfJoinThread thread;
+ thread.Start();
+ thread.Join();
+}
+
+
+namespace {
+
+class ThreadLocalStorageTest : public Thread, public ::testing::Test {
+ public:
+ ThreadLocalStorageTest() : Thread(Options("ThreadLocalStorageTest")) {
+ for (size_t i = 0; i < arraysize(keys_); ++i) {
+ keys_[i] = Thread::CreateThreadLocalKey();
+ }
+ }
+ ~ThreadLocalStorageTest() {
+ for (size_t i = 0; i < arraysize(keys_); ++i) {
+ Thread::DeleteThreadLocalKey(keys_[i]);
+ }
+ }
+
+ virtual void Run() V8_FINAL V8_OVERRIDE {
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ CHECK(!Thread::HasThreadLocal(keys_[i]));
+ }
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ Thread::SetThreadLocal(keys_[i], GetValue(i));
+ }
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ CHECK(Thread::HasThreadLocal(keys_[i]));
+ }
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ CHECK_EQ(GetValue(i), Thread::GetThreadLocal(keys_[i]));
+ CHECK_EQ(GetValue(i), Thread::GetExistingThreadLocal(keys_[i]));
+ }
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ Thread::SetThreadLocal(keys_[i], GetValue(arraysize(keys_) - i - 1));
+ }
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ CHECK(Thread::HasThreadLocal(keys_[i]));
+ }
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ CHECK_EQ(GetValue(arraysize(keys_) - i - 1),
+ Thread::GetThreadLocal(keys_[i]));
+ CHECK_EQ(GetValue(arraysize(keys_) - i - 1),
+ Thread::GetExistingThreadLocal(keys_[i]));
+ }
+ }
+
+ private:
+ static void* GetValue(size_t x) {
+ return reinterpret_cast<void*>(static_cast<uintptr_t>(x + 1));
+ }
+
+ Thread::LocalStorageKey keys_[256];
+};
+
+} // namespace
+
+
+TEST_F(ThreadLocalStorageTest, DoTest) {
+ Run();
+ Start();
+ Join();
+}
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/platform/semaphore-unittest.cc Mon Sep 1 00:05:43 2014
UTC
@@ -0,0 +1,145 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <cstring>
+
+#include "src/base/platform/platform.h"
+#include "src/base/platform/semaphore.h"
+#include "src/base/platform/time.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace base {
+
+namespace {
+
+static const char kAlphabet[] = "XKOAD";
+static const size_t kAlphabetSize = sizeof(kAlphabet) - 1;
+static const size_t kBufferSize = 987; // GCD(buffer size, alphabet size)
= 1
+static const size_t kDataSize = kBufferSize * kAlphabetSize * 10;
+
+
+class ProducerThread V8_FINAL : public Thread {
+ public:
+ ProducerThread(char* buffer, Semaphore* free_space, Semaphore*
used_space)
+ : Thread(Options("ProducerThread")),
+ buffer_(buffer),
+ free_space_(free_space),
+ used_space_(used_space) {}
+ virtual ~ProducerThread() {}
+
+ virtual void Run() V8_OVERRIDE {
+ for (size_t n = 0; n < kDataSize; ++n) {
+ free_space_->Wait();
+ buffer_[n % kBufferSize] = kAlphabet[n % kAlphabetSize];
+ used_space_->Signal();
+ }
+ }
+
+ private:
+ char* buffer_;
+ Semaphore* const free_space_;
+ Semaphore* const used_space_;
+};
+
+
+class ConsumerThread V8_FINAL : public Thread {
+ public:
+ ConsumerThread(const char* buffer, Semaphore* free_space,
+ Semaphore* used_space)
+ : Thread(Options("ConsumerThread")),
+ buffer_(buffer),
+ free_space_(free_space),
+ used_space_(used_space) {}
+ virtual ~ConsumerThread() {}
+
+ virtual void Run() V8_OVERRIDE {
+ for (size_t n = 0; n < kDataSize; ++n) {
+ used_space_->Wait();
+ EXPECT_EQ(kAlphabet[n % kAlphabetSize], buffer_[n % kBufferSize]);
+ free_space_->Signal();
+ }
+ }
+
+ private:
+ const char* buffer_;
+ Semaphore* const free_space_;
+ Semaphore* const used_space_;
+};
+
+
+class WaitAndSignalThread V8_FINAL : public Thread {
+ public:
+ explicit WaitAndSignalThread(Semaphore* semaphore)
+ : Thread(Options("WaitAndSignalThread")), semaphore_(semaphore) {}
+ virtual ~WaitAndSignalThread() {}
+
+ virtual void Run() V8_OVERRIDE {
+ for (int n = 0; n < 100; ++n) {
+ semaphore_->Wait();
+ ASSERT_FALSE(semaphore_->WaitFor(TimeDelta::FromMicroseconds(1)));
+ semaphore_->Signal();
+ }
+ }
+
+ private:
+ Semaphore* const semaphore_;
+};
+
+} // namespace
+
+
+TEST(Semaphore, ProducerConsumer) {
+ char buffer[kBufferSize];
+ std::memset(buffer, 0, sizeof(buffer));
+ Semaphore free_space(kBufferSize);
+ Semaphore used_space(0);
+ ProducerThread producer_thread(buffer, &free_space, &used_space);
+ ConsumerThread consumer_thread(buffer, &free_space, &used_space);
+ producer_thread.Start();
+ consumer_thread.Start();
+ producer_thread.Join();
+ consumer_thread.Join();
+}
+
+
+TEST(Semaphore, WaitAndSignal) {
+ Semaphore semaphore(0);
+ WaitAndSignalThread t1(&semaphore);
+ WaitAndSignalThread t2(&semaphore);
+
+ t1.Start();
+ t2.Start();
+
+ // Make something available.
+ semaphore.Signal();
+
+ t1.Join();
+ t2.Join();
+
+ semaphore.Wait();
+
+ EXPECT_FALSE(semaphore.WaitFor(TimeDelta::FromMicroseconds(1)));
+}
+
+
+TEST(Semaphore, WaitFor) {
+ Semaphore semaphore(0);
+
+ // Semaphore not signalled - timeout.
+ ASSERT_FALSE(semaphore.WaitFor(TimeDelta::FromMicroseconds(0)));
+ ASSERT_FALSE(semaphore.WaitFor(TimeDelta::FromMicroseconds(100)));
+ ASSERT_FALSE(semaphore.WaitFor(TimeDelta::FromMicroseconds(1000)));
+
+ // Semaphore signalled - no timeout.
+ semaphore.Signal();
+ ASSERT_TRUE(semaphore.WaitFor(TimeDelta::FromMicroseconds(0)));
+ semaphore.Signal();
+ ASSERT_TRUE(semaphore.WaitFor(TimeDelta::FromMicroseconds(100)));
+ semaphore.Signal();
+ ASSERT_TRUE(semaphore.WaitFor(TimeDelta::FromMicroseconds(1000)));
+}
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/platform/time-unittest.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,186 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/platform/time.h"
+
+#if V8_OS_MACOSX
+#include <mach/mach_time.h>
+#endif
+#if V8_OS_POSIX
+#include <sys/time.h>
+#endif
+
+#if V8_OS_WIN
+#include "src/base/win32-headers.h"
+#endif
+
+#include "src/base/platform/elapsed-timer.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace base {
+
+TEST(TimeDelta, FromAndIn) {
+ EXPECT_EQ(TimeDelta::FromDays(2), TimeDelta::FromHours(48));
+ EXPECT_EQ(TimeDelta::FromHours(3), TimeDelta::FromMinutes(180));
+ EXPECT_EQ(TimeDelta::FromMinutes(2), TimeDelta::FromSeconds(120));
+ EXPECT_EQ(TimeDelta::FromSeconds(2), TimeDelta::FromMilliseconds(2000));
+ EXPECT_EQ(TimeDelta::FromMilliseconds(2),
TimeDelta::FromMicroseconds(2000));
+ EXPECT_EQ(static_cast<int>(13), TimeDelta::FromDays(13).InDays());
+ EXPECT_EQ(static_cast<int>(13), TimeDelta::FromHours(13).InHours());
+ EXPECT_EQ(static_cast<int>(13), TimeDelta::FromMinutes(13).InMinutes());
+ EXPECT_EQ(static_cast<int64_t>(13),
TimeDelta::FromSeconds(13).InSeconds());
+ EXPECT_DOUBLE_EQ(13.0, TimeDelta::FromSeconds(13).InSecondsF());
+ EXPECT_EQ(static_cast<int64_t>(13),
+ TimeDelta::FromMilliseconds(13).InMilliseconds());
+ EXPECT_DOUBLE_EQ(13.0,
TimeDelta::FromMilliseconds(13).InMillisecondsF());
+ EXPECT_EQ(static_cast<int64_t>(13),
+ TimeDelta::FromMicroseconds(13).InMicroseconds());
+}
+
+
+#if V8_OS_MACOSX
+TEST(TimeDelta, MachTimespec) {
+ TimeDelta null = TimeDelta();
+ EXPECT_EQ(null, TimeDelta::FromMachTimespec(null.ToMachTimespec()));
+ TimeDelta delta1 = TimeDelta::FromMilliseconds(42);
+ EXPECT_EQ(delta1, TimeDelta::FromMachTimespec(delta1.ToMachTimespec()));
+ TimeDelta delta2 = TimeDelta::FromDays(42);
+ EXPECT_EQ(delta2, TimeDelta::FromMachTimespec(delta2.ToMachTimespec()));
+}
+#endif
+
+
+TEST(Time, JsTime) {
+ Time t = Time::FromJsTime(700000.3);
+ EXPECT_DOUBLE_EQ(700000.3, t.ToJsTime());
+}
+
+
+#if V8_OS_POSIX
+TEST(Time, Timespec) {
+ Time null;
+ EXPECT_TRUE(null.IsNull());
+ EXPECT_EQ(null, Time::FromTimespec(null.ToTimespec()));
+ Time now = Time::Now();
+ EXPECT_EQ(now, Time::FromTimespec(now.ToTimespec()));
+ Time now_sys = Time::NowFromSystemTime();
+ EXPECT_EQ(now_sys, Time::FromTimespec(now_sys.ToTimespec()));
+ Time unix_epoch = Time::UnixEpoch();
+ EXPECT_EQ(unix_epoch, Time::FromTimespec(unix_epoch.ToTimespec()));
+ Time max = Time::Max();
+ EXPECT_TRUE(max.IsMax());
+ EXPECT_EQ(max, Time::FromTimespec(max.ToTimespec()));
+}
+
+
+TEST(Time, Timeval) {
+ Time null;
+ EXPECT_TRUE(null.IsNull());
+ EXPECT_EQ(null, Time::FromTimeval(null.ToTimeval()));
+ Time now = Time::Now();
+ EXPECT_EQ(now, Time::FromTimeval(now.ToTimeval()));
+ Time now_sys = Time::NowFromSystemTime();
+ EXPECT_EQ(now_sys, Time::FromTimeval(now_sys.ToTimeval()));
+ Time unix_epoch = Time::UnixEpoch();
+ EXPECT_EQ(unix_epoch, Time::FromTimeval(unix_epoch.ToTimeval()));
+ Time max = Time::Max();
+ EXPECT_TRUE(max.IsMax());
+ EXPECT_EQ(max, Time::FromTimeval(max.ToTimeval()));
+}
+#endif
+
+
+#if V8_OS_WIN
+TEST(Time, Filetime) {
+ Time null;
+ EXPECT_TRUE(null.IsNull());
+ EXPECT_EQ(null, Time::FromFiletime(null.ToFiletime()));
+ Time now = Time::Now();
+ EXPECT_EQ(now, Time::FromFiletime(now.ToFiletime()));
+ Time now_sys = Time::NowFromSystemTime();
+ EXPECT_EQ(now_sys, Time::FromFiletime(now_sys.ToFiletime()));
+ Time unix_epoch = Time::UnixEpoch();
+ EXPECT_EQ(unix_epoch, Time::FromFiletime(unix_epoch.ToFiletime()));
+ Time max = Time::Max();
+ EXPECT_TRUE(max.IsMax());
+ EXPECT_EQ(max, Time::FromFiletime(max.ToFiletime()));
+}
+#endif
+
+
+namespace {
+
+template <typename T>
+static void ResolutionTest(T (*Now)(), TimeDelta target_granularity) {
+ // We're trying to measure that intervals increment in a VERY small
amount
+ // of time -- according to the specified target granularity.
Unfortunately,
+ // if we happen to have a context switch in the middle of our test, the
+ // context switch could easily exceed our limit. So, we iterate on this
+ // several times. As long as we're able to detect the fine-granularity
+ // timers at least once, then the test has succeeded.
+ static const TimeDelta kExpirationTimeout = TimeDelta::FromSeconds(1);
+ ElapsedTimer timer;
+ timer.Start();
+ TimeDelta delta;
+ do {
+ T start = Now();
+ T now = start;
+ // Loop until we can detect that the clock has changed. Non-HighRes
timers
+ // will increment in chunks, i.e. 15ms. By spinning until we see a
clock
+ // change, we detect the minimum time between measurements.
+ do {
+ now = Now();
+ delta = now - start;
+ } while (now <= start);
+ EXPECT_NE(static_cast<int64_t>(0), delta.InMicroseconds());
+ } while (delta > target_granularity
&& !timer.HasExpired(kExpirationTimeout));
+ EXPECT_LE(delta, target_granularity);
+}
+
+} // namespace
+
+
+TEST(Time, NowResolution) {
+ // We assume that Time::Now() has at least 16ms resolution.
+ static const TimeDelta kTargetGranularity =
TimeDelta::FromMilliseconds(16);
+ ResolutionTest<Time>(&Time::Now, kTargetGranularity);
+}
+
+
+TEST(TimeTicks, NowResolution) {
+ // We assume that TimeTicks::Now() has at least 16ms resolution.
+ static const TimeDelta kTargetGranularity =
TimeDelta::FromMilliseconds(16);
+ ResolutionTest<TimeTicks>(&TimeTicks::Now, kTargetGranularity);
+}
+
+
+TEST(TimeTicks, HighResolutionNowResolution) {
+ if (!TimeTicks::IsHighResolutionClockWorking()) return;
+
+ // We assume that TimeTicks::HighResolutionNow() has sub-ms resolution.
+ static const TimeDelta kTargetGranularity =
TimeDelta::FromMilliseconds(1);
+ ResolutionTest<TimeTicks>(&TimeTicks::HighResolutionNow,
kTargetGranularity);
+}
+
+
+TEST(TimeTicks, IsMonotonic) {
+ TimeTicks previous_normal_ticks;
+ TimeTicks previous_highres_ticks;
+ ElapsedTimer timer;
+ timer.Start();
+ while (!timer.HasExpired(TimeDelta::FromMilliseconds(100))) {
+ TimeTicks normal_ticks = TimeTicks::Now();
+ TimeTicks highres_ticks = TimeTicks::HighResolutionNow();
+ EXPECT_GE(normal_ticks, previous_normal_ticks);
+ EXPECT_GE((normal_ticks - previous_normal_ticks).InMicroseconds(), 0);
+ EXPECT_GE(highres_ticks, previous_highres_ticks);
+ EXPECT_GE((highres_ticks - previous_highres_ticks).InMicroseconds(),
0);
+ previous_normal_ticks = normal_ticks;
+ previous_highres_ticks = highres_ticks;
+ }
+}
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/sys-info-unittest.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,32 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/sys-info.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#if V8_OS_NACL
+#define DISABLE_ON_NACL(Name) DISABLED_##Name
+#else
+#define DISABLE_ON_NACL(Name) Name
+#endif
+
+namespace v8 {
+namespace base {
+
+TEST(SysInfoTest, NumberOfProcessors) {
+ EXPECT_LT(0, SysInfo::NumberOfProcessors());
+}
+
+
+TEST(SysInfoTest, DISABLE_ON_NACL(AmountOfPhysicalMemory)) {
+ EXPECT_LT(0, SysInfo::AmountOfPhysicalMemory());
+}
+
+
+TEST(SysInfoTest, AmountOfVirtualMemory) {
+ EXPECT_LE(0, SysInfo::AmountOfVirtualMemory());
+}
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/base/utils/random-number-generator-unittest.cc Mon Sep 1
00:05:43 2014 UTC
@@ -0,0 +1,53 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <climits>
+
+#include "src/base/utils/random-number-generator.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace base {
+
+class RandomNumberGeneratorTest : public ::testing::TestWithParam<int> {};
+
+
+static const int kMaxRuns = 12345;
+
+
+TEST_P(RandomNumberGeneratorTest, NextIntWithMaxValue) {
+ RandomNumberGenerator rng(GetParam());
+ for (int max = 1; max <= kMaxRuns; ++max) {
+ int n = rng.NextInt(max);
+ EXPECT_LE(0, n);
+ EXPECT_LT(n, max);
+ }
+}
+
+
+TEST_P(RandomNumberGeneratorTest, NextBooleanReturnsFalseOrTrue) {
+ RandomNumberGenerator rng(GetParam());
+ for (int k = 0; k < kMaxRuns; ++k) {
+ bool b = rng.NextBool();
+ EXPECT_TRUE(b == false || b == true);
+ }
+}
+
+
+TEST_P(RandomNumberGeneratorTest, NextDoubleReturnsValueBetween0And1) {
+ RandomNumberGenerator rng(GetParam());
+ for (int k = 0; k < kMaxRuns; ++k) {
+ double d = rng.NextDouble();
+ EXPECT_LE(0.0, d);
+ EXPECT_LT(d, 1.0);
+ }
+}
+
+
+INSTANTIATE_TEST_CASE_P(RandomSeeds, RandomNumberGeneratorTest,
+ ::testing::Values(INT_MIN, -1, 0, 1, 42, 100,
+ 1234567890, 987654321, INT_MAX));
+
+} // namespace base
+} // namespace v8
=======================================
--- /dev/null
+++ /trunk/src/ia32/interface-descriptors-ia32.cc Mon Sep 1 00:05:43 2014
UTC
@@ -0,0 +1,97 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#if V8_TARGET_ARCH_IA32
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+const Register InterfaceDescriptor::ContextRegister() { return esi; }
+
+
+void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall);
+ Register registers[] = {
+ esi, // context
+ edi, // JSFunction
+ eax, // actual number of arguments
+ ebx, // expected number of arguments
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // JSFunction
+ Representation::Integer32(), // actual number of arguments
+ Representation::Integer32(), // expected number of arguments
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::KeyedCall);
+ Register registers[] = {
+ esi, // context
+ ecx, // key
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // key
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::NamedCall);
+ Register registers[] = {
+ esi, // context
+ ecx, // name
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // name
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::CallHandler);
+ Register registers[] = {
+ esi, // context
+ edx, // name
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ApiFunctionCall);
+ Register registers[] = {
+ esi, // context
+ eax, // callee
+ ebx, // call_data
+ ecx, // holder
+ edx, // api_function_address
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // callee
+ Representation::Tagged(), // call_data
+ Representation::Tagged(), // holder
+ Representation::External(), // api_function_address
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+}
+}
+} // namespace v8::internal
+
+#endif // V8_TARGET_ARCH_IA32
=======================================
--- /dev/null
+++ /trunk/src/interface-descriptors.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,55 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+InterfaceDescriptor::InterfaceDescriptor() : register_param_count_(-1) {}
+
+
+void InterfaceDescriptor::Initialize(
+ int register_parameter_count, Register* registers,
+ Representation* register_param_representations,
+ PlatformInterfaceDescriptor* platform_descriptor) {
+ platform_specific_descriptor_ = platform_descriptor;
+ register_param_count_ = register_parameter_count;
+
+ // An interface descriptor must have a context register.
+ DCHECK(register_parameter_count > 0 &&
registers[0].is(ContextRegister()));
+
+ // InterfaceDescriptor owns a copy of the registers array.
+ register_params_.Reset(NewArray<Register>(register_parameter_count));
+ for (int i = 0; i < register_parameter_count; i++) {
+ register_params_[i] = registers[i];
+ }
+
+ // If a representations array is specified, then the descriptor owns
that as
+ // well.
+ if (register_param_representations != NULL) {
+ register_param_representations_.Reset(
+ NewArray<Representation>(register_parameter_count));
+ for (int i = 0; i < register_parameter_count; i++) {
+ // If there is a context register, the representation must be tagged.
+ DCHECK(
+ i != 0 ||
+
register_param_representations[i].Equals(Representation::Tagged()));
+ register_param_representations_[i] =
register_param_representations[i];
+ }
+ }
+}
+
+
+void CallInterfaceDescriptor::Initialize(
+ int register_parameter_count, Register* registers,
+ Representation* param_representations,
+ PlatformInterfaceDescriptor* platform_descriptor) {
+ InterfaceDescriptor::Initialize(register_parameter_count, registers,
+ param_representations,
platform_descriptor);
+}
+}
+} // namespace v8::internal
=======================================
--- /dev/null
+++ /trunk/src/interface-descriptors.h Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,126 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_CALL_INTERFACE_DESCRIPTOR_H_
+#define V8_CALL_INTERFACE_DESCRIPTOR_H_
+
+#include "src/assembler.h"
+#include "src/macro-assembler.h"
+
+namespace v8 {
+namespace internal {
+
+class PlatformInterfaceDescriptor;
+
+class InterfaceDescriptor {
+ public:
+ bool IsInitialized() const { return register_param_count_ >= 0; }
+
+ int GetEnvironmentLength() const { return register_param_count_; }
+
+ int GetRegisterParameterCount() const { return register_param_count_; }
+
+ Register GetParameterRegister(int index) const {
+ return register_params_[index];
+ }
+
+ Representation GetParameterRepresentation(int index) const {
+ DCHECK(index < register_param_count_);
+ if (register_param_representations_.get() == NULL) {
+ return Representation::Tagged();
+ }
+
+ return register_param_representations_[index];
+ }
+
+ // "Environment" versions of parameter functions. The first register
+ // parameter (context) is not included.
+ int GetEnvironmentParameterCount() const {
+ return GetEnvironmentLength() - 1;
+ }
+
+ Register GetEnvironmentParameterRegister(int index) const {
+ return GetParameterRegister(index + 1);
+ }
+
+ Representation GetEnvironmentParameterRepresentation(int index) const {
+ return GetParameterRepresentation(index + 1);
+ }
+
+ // Some platforms have extra information to associate with the
descriptor.
+ PlatformInterfaceDescriptor* platform_specific_descriptor() const {
+ return platform_specific_descriptor_;
+ }
+
+ static const Register ContextRegister();
+
+ protected:
+ InterfaceDescriptor();
+ virtual ~InterfaceDescriptor() {}
+
+ void Initialize(int register_parameter_count, Register* registers,
+ Representation* register_param_representations,
+ PlatformInterfaceDescriptor* platform_descriptor = NULL);
+
+ private:
+ int register_param_count_;
+
+ // The Register params are allocated dynamically by the
+ // InterfaceDescriptor, and freed on destruction. This is because static
+ // arrays of Registers cause creation of runtime static initializers
+ // which we don't want.
+ SmartArrayPointer<Register> register_params_;
+ // Specifies Representations for the stub's parameter. Points to an
array of
+ // Representations of the same length of the numbers of parameters to the
+ // stub, or if NULL (the default value), Representation of each parameter
+ // assumed to be Tagged().
+ SmartArrayPointer<Representation> register_param_representations_;
+
+ PlatformInterfaceDescriptor* platform_specific_descriptor_;
+
+ DISALLOW_COPY_AND_ASSIGN(InterfaceDescriptor);
+};
+
+
+enum CallDescriptorKey {
+ KeyedCall,
+ NamedCall,
+ CallHandler,
+ ArgumentAdaptorCall,
+ ApiFunctionCall,
+ NUMBER_OF_CALL_DESCRIPTORS
+};
+
+
+class CallInterfaceDescriptor : public InterfaceDescriptor {
+ public:
+ CallInterfaceDescriptor() {}
+
+ // A copy of the passed in registers and param_representations is made
+ // and owned by the CallInterfaceDescriptor.
+
+ // TODO(mvstanton): Instead of taking parallel arrays register and
+ // param_representations, how about a struct that puts the representation
+ // and register side by side (eg, RegRep(r1, Representation::Tagged()).
+ // The same should go for the CodeStubInterfaceDescriptor class.
+ void Initialize(int register_parameter_count, Register* registers,
+ Representation* param_representations,
+ PlatformInterfaceDescriptor* platform_descriptor = NULL);
+};
+
+
+class CallDescriptors {
+ public:
+ static void InitializeForIsolate(Isolate* isolate);
+};
+}
+} // namespace v8::internal
+
+#if V8_TARGET_ARCH_ARM64
+#include "src/arm64/interface-descriptors-arm64.h"
+#elif V8_TARGET_ARCH_ARM
+#include "src/arm/interface-descriptors-arm.h"
+#endif
+
+#endif // V8_CALL_INTERFACE_DESCRIPTOR_H_
=======================================
--- /dev/null
+++ /trunk/src/mips/interface-descriptors-mips.cc Mon Sep 1 00:05:43 2014
UTC
@@ -0,0 +1,92 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#if V8_TARGET_ARCH_MIPS
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+const Register InterfaceDescriptor::ContextRegister() { return cp; }
+
+
+void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall);
+ Register registers[] = { cp, // context,
+ a1, // JSFunction
+ a0, // actual number of arguments
+ a2, // expected number of arguments
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // JSFunction
+ Representation::Integer32(), // actual number of arguments
+ Representation::Integer32(), // expected number of arguments
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::KeyedCall);
+ Register registers[] = { cp, // context
+ a2, // key
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // key
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::NamedCall);
+ Register registers[] = { cp, // context
+ a2, // name
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // name
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::CallHandler);
+ Register registers[] = { cp, // context
+ a0, // receiver
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ApiFunctionCall);
+ Register registers[] = { cp, // context
+ a0, // callee
+ t0, // call_data
+ a2, // holder
+ a1, // api_function_address
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // callee
+ Representation::Tagged(), // call_data
+ Representation::Tagged(), // holder
+ Representation::External(), // api_function_address
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+}
+}
+} // namespace v8::internal
+
+#endif // V8_TARGET_ARCH_MIPS
=======================================
--- /dev/null
+++ /trunk/src/mips64/interface-descriptors-mips64.cc Mon Sep 1 00:05:43
2014 UTC
@@ -0,0 +1,92 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#if V8_TARGET_ARCH_MIPS64
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+const Register InterfaceDescriptor::ContextRegister() { return cp; }
+
+
+void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall);
+ Register registers[] = { cp, // context
+ a1, // JSFunction
+ a0, // actual number of arguments
+ a2, // expected number of arguments
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // JSFunction
+ Representation::Integer32(), // actual number of arguments
+ Representation::Integer32(), // expected number of arguments
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::KeyedCall);
+ Register registers[] = { cp, // context
+ a2, // key
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // key
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::NamedCall);
+ Register registers[] = { cp, // context
+ a2, // name
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // name
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::CallHandler);
+ Register registers[] = { cp, // context
+ a0, // receiver
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ApiFunctionCall);
+ Register registers[] = { cp, // context
+ a0, // callee
+ a4, // call_data
+ a2, // holder
+ a1, // api_function_address
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // callee
+ Representation::Tagged(), // call_data
+ Representation::Tagged(), // holder
+ Representation::External(), // api_function_address
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+}
+}
+} // namespace v8::internal
+
+#endif // V8_TARGET_ARCH_MIPS64
=======================================
--- /dev/null
+++ /trunk/src/x64/interface-descriptors-x64.cc Mon Sep 1 00:05:43 2014 UTC
@@ -0,0 +1,97 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/v8.h"
+
+#if V8_TARGET_ARCH_X64
+
+#include "src/interface-descriptors.h"
+
+namespace v8 {
+namespace internal {
+
+const Register InterfaceDescriptor::ContextRegister() { return rsi; }
+
+
+void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall);
+ Register registers[] = {
+ rsi, // context
+ rdi, // JSFunction
+ rax, // actual number of arguments
+ rbx, // expected number of arguments
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // JSFunction
+ Representation::Integer32(), // actual number of arguments
+ Representation::Integer32(), // expected number of arguments
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::KeyedCall);
+ Register registers[] = {
+ rsi, // context
+ rcx, // key
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // key
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::NamedCall);
+ Register registers[] = {
+ rsi, // context
+ rcx, // name
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // name
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::CallHandler);
+ Register registers[] = {
+ rsi, // context
+ rdx, // receiver
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(CallDescriptorKey::ApiFunctionCall);
+ Register registers[] = {
+ rsi, // context
+ rax, // callee
+ rbx, // call_data
+ rcx, // holder
+ rdx, // api_function_address
+ };
+ Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // callee
+ Representation::Tagged(), // call_data
+ Representation::Tagged(), // holder
+ Representation::External(), // api_function_address
+ };
+ descriptor->Initialize(arraysize(registers), registers,
representations);
+ }
+}
+}
+} // namespace v8::internal
+
+#endif // V8_TARGET_ARCH_X64
=======================================
--- /trunk/test/base-unittests/DEPS Wed Aug 20 00:06:26 2014 UTC
+++ /dev/null
@@ -1,9 +0,0 @@
-include_rules = [
- "-include",
- "+include/v8config.h",
- "+include/v8stdint.h",
- "-src",
- "+src/base",
- "+testing/gtest",
- "+testing/gtest-support.h",
-]
=======================================
--- /trunk/test/base-unittests/base-unittests.gyp Thu Aug 28 07:03:22 2014
UTC
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2014 the V8 project authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'variables': {
- 'v8_code': 1,
- },
- 'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'],
- 'targets': [
- {
- 'target_name': 'base-unittests',
- 'type': 'executable',
- 'dependencies': [
- '../../testing/gtest.gyp:gtest',
- '../../testing/gtest.gyp:gtest_main',
- '../../tools/gyp/v8.gyp:v8_libbase',
- ],
- 'include_dirs': [
- '../..',
- ],
- 'sources': [ ### gcmole(all) ###
- 'bits-unittest.cc',
- 'cpu-unittest.cc',
- 'flags-unittest.cc',
- 'platform/condition-variable-unittest.cc',
- 'platform/mutex-unittest.cc',
- 'platform/platform-unittest.cc',
- 'platform/semaphore-unittest.cc',
- 'platform/time-unittest.cc',
- 'sys-info-unittest.cc',
- 'utils/random-number-generator-unittest.cc',
- ],
- 'conditions': [
- ['os_posix == 1', {
- # TODO(svenpanne): This is a temporary work-around to fix the
warnings
- # that show up because we use -std=gnu++0x instead of -std=c++11.
- 'cflags!': [
- '-pedantic',
- ],
- }],
- ],
- },
- ],
-}
=======================================
--- /trunk/test/base-unittests/bits-unittest.cc Mon Aug 25 19:57:56 2014 UTC
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/base/bits.h"
-#include "src/base/macros.h"
-#include "testing/gtest-support.h"
-
-namespace v8 {
-namespace base {
-namespace bits {
-
-TEST(BitsTest, CountPopulation32) {
- EXPECT_EQ(0u, CountPopulation32(0));
- EXPECT_EQ(1u, CountPopulation32(1));
- EXPECT_EQ(8u, CountPopulation32(0x11111111));
- EXPECT_EQ(16u, CountPopulation32(0xf0f0f0f0));
- EXPECT_EQ(24u, CountPopulation32(0xfff0f0ff));
- EXPECT_EQ(32u, CountPopulation32(0xffffffff));
-}
-
-
-TEST(BitsTest, CountLeadingZeros32) {
- EXPECT_EQ(32u, CountLeadingZeros32(0));
- EXPECT_EQ(31u, CountLeadingZeros32(1));
- TRACED_FORRANGE(uint32_t, shift, 0, 31) {
- EXPECT_EQ(31u - shift, CountLeadingZeros32(1u << shift));
- }
- EXPECT_EQ(4u, CountLeadingZeros32(0x0f0f0f0f));
-}
-
-
-TEST(BitsTest, CountTrailingZeros32) {
- EXPECT_EQ(32u, CountTrailingZeros32(0));
- EXPECT_EQ(31u, CountTrailingZeros32(0x80000000));
- TRACED_FORRANGE(uint32_t, shift, 0, 31) {
- EXPECT_EQ(shift, CountTrailingZeros32(1u << shift));
- }
- EXPECT_EQ(4u, CountTrailingZeros32(0xf0f0f0f0));
-}
-
-
-TEST(BitsTest, RotateRight32) {
- TRACED_FORRANGE(uint32_t, shift, 0, 31) {
- EXPECT_EQ(0u, RotateRight32(0u, shift));
- }
- EXPECT_EQ(1u, RotateRight32(1, 0));
- EXPECT_EQ(1u, RotateRight32(2, 1));
- EXPECT_EQ(0x80000000u, RotateRight32(1, 1));
-}
-
-
-TEST(BitsTest, RotateRight64) {
- TRACED_FORRANGE(uint64_t, shift, 0, 63) {
- EXPECT_EQ(0u, RotateRight64(0u, shift));
- }
- EXPECT_EQ(1u, RotateRight64(1, 0));
- EXPECT_EQ(1u, RotateRight64(2, 1));
- EXPECT_EQ(V8_UINT64_C(0x8000000000000000), RotateRight64(1, 1));
-}
-
-} // namespace bits
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/cpu-unittest.cc Thu Aug 7 08:39:21 2014 UTC
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/base/cpu.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace base {
-
-TEST(CPUTest, FeatureImplications) {
- CPU cpu;
-
- // ia32 and x64 features
- EXPECT_TRUE(!cpu.has_sse() || cpu.has_mmx());
- EXPECT_TRUE(!cpu.has_sse2() || cpu.has_sse());
- EXPECT_TRUE(!cpu.has_sse3() || cpu.has_sse2());
- EXPECT_TRUE(!cpu.has_ssse3() || cpu.has_sse3());
- EXPECT_TRUE(!cpu.has_sse41() || cpu.has_sse3());
- EXPECT_TRUE(!cpu.has_sse42() || cpu.has_sse41());
-
- // arm features
- EXPECT_TRUE(!cpu.has_vfp3_d32() || cpu.has_vfp3());
-}
-
-
-TEST(CPUTest, RequiredFeatures) {
- CPU cpu;
-
-#if V8_HOST_ARCH_ARM
- EXPECT_TRUE(cpu.has_fpu());
-#endif
-
-#if V8_HOST_ARCH_IA32
- EXPECT_TRUE(cpu.has_fpu());
- EXPECT_TRUE(cpu.has_sahf());
-#endif
-
-#if V8_HOST_ARCH_X64
- EXPECT_TRUE(cpu.has_fpu());
- EXPECT_TRUE(cpu.has_cmov());
- EXPECT_TRUE(cpu.has_mmx());
- EXPECT_TRUE(cpu.has_sse());
- EXPECT_TRUE(cpu.has_sse2());
-#endif
-}
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/flags-unittest.cc Thu Aug 28 07:03:22 2014
UTC
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/base/flags.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace base {
-
-namespace {
-
-enum Flag1 {
- kFlag1None = 0,
- kFlag1First = 1u << 1,
- kFlag1Second = 1u << 2,
- kFlag1All = kFlag1None | kFlag1First | kFlag1Second
-};
-DEFINE_FLAGS(Flags1, Flag1);
-
-
-DEFINE_OPERATORS_FOR_FLAGS(Flags1)
-
-
-Flags1 bar(Flags1 flags1) { return flags1; }
-
-} // namespace
-
-
-TEST(FlagsTest, BasicOperations) {
- Flags1 a;
- EXPECT_EQ(kFlag1None, static_cast<int>(a));
- a |= kFlag1First;
- EXPECT_EQ(kFlag1First, static_cast<int>(a));
- a = a | kFlag1Second;
- EXPECT_EQ(kFlag1All, static_cast<int>(a));
- a &= kFlag1Second;
- EXPECT_EQ(kFlag1Second, static_cast<int>(a));
- a = kFlag1None & a;
- EXPECT_EQ(kFlag1None, static_cast<int>(a));
- a ^= (kFlag1All | kFlag1None);
- EXPECT_EQ(kFlag1All, static_cast<int>(a));
- Flags1 b = ~a;
- EXPECT_EQ(kFlag1All, static_cast<int>(a));
- EXPECT_EQ(~static_cast<int>(a), static_cast<int>(b));
- Flags1 c = a;
- EXPECT_EQ(a, c);
- EXPECT_NE(a, b);
- EXPECT_EQ(a, bar(a));
- EXPECT_EQ(a, bar(kFlag1All));
-}
-
-
-namespace {
-namespace foo {
-
-enum Option {
- kNoOptions = 0,
- kOption1 = 1,
- kOption2 = 2,
- kAllOptions = kNoOptions | kOption1 | kOption2
-};
-DEFINE_FLAGS(Options, Option);
-
-} // namespace foo
-
-
-DEFINE_OPERATORS_FOR_FLAGS(foo::Options)
-
-} // namespace
-
-
-TEST(FlagsTest, NamespaceScope) {
- foo::Options options;
- options ^= foo::kNoOptions;
- options |= foo::kOption1 | foo::kOption2;
- EXPECT_EQ(foo::kAllOptions, static_cast<int>(options));
-}
-
-
-namespace {
-
-struct Foo {
- enum Enum { kEnum1 = 1, kEnum2 = 2 };
- DEFINE_FLAGS(Enums, Enum);
-};
-
-
-DEFINE_OPERATORS_FOR_FLAGS(Foo::Enums)
-
-} // namespace
-
-
-TEST(FlagsTest, ClassScope) {
- Foo::Enums enums;
- enums |= Foo::kEnum1;
- enums |= Foo::kEnum2;
- EXPECT_TRUE(enums & Foo::kEnum1);
- EXPECT_TRUE(enums & Foo::kEnum2);
-}
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/platform/condition-variable-unittest.cc Wed
Aug 20 00:06:26 2014 UTC
+++ /dev/null
@@ -1,301 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/base/platform/condition-variable.h"
-
-#include "src/base/platform/platform.h"
-#include "src/base/platform/time.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace base {
-
-TEST(ConditionVariable, WaitForAfterNofityOnSameThread) {
- for (int n = 0; n < 10; ++n) {
- Mutex mutex;
- ConditionVariable cv;
-
- LockGuard<Mutex> lock_guard(&mutex);
-
- cv.NotifyOne();
- EXPECT_FALSE(cv.WaitFor(&mutex, TimeDelta::FromMicroseconds(n)));
-
- cv.NotifyAll();
- EXPECT_FALSE(cv.WaitFor(&mutex, TimeDelta::FromMicroseconds(n)));
- }
-}
-
-
-namespace {
-
-class ThreadWithMutexAndConditionVariable V8_FINAL : public Thread {
- public:
- ThreadWithMutexAndConditionVariable()
- : Thread(Options("ThreadWithMutexAndConditionVariable")),
- running_(false),
- finished_(false) {}
- virtual ~ThreadWithMutexAndConditionVariable() {}
-
- virtual void Run() V8_OVERRIDE {
- LockGuard<Mutex> lock_guard(&mutex_);
- running_ = true;
- cv_.NotifyOne();
- while (running_) {
- cv_.Wait(&mutex_);
- }
- finished_ = true;
- cv_.NotifyAll();
- }
-
- bool running_;
- bool finished_;
- ConditionVariable cv_;
- Mutex mutex_;
-};
-
-}
-
-
-TEST(ConditionVariable, MultipleThreadsWithSeparateConditionVariables) {
- static const int kThreadCount = 128;
- ThreadWithMutexAndConditionVariable threads[kThreadCount];
-
- for (int n = 0; n < kThreadCount; ++n) {
- LockGuard<Mutex> lock_guard(&threads[n].mutex_);
- EXPECT_FALSE(threads[n].running_);
- EXPECT_FALSE(threads[n].finished_);
- threads[n].Start();
- // Wait for nth thread to start.
- while (!threads[n].running_) {
- threads[n].cv_.Wait(&threads[n].mutex_);
- }
- }
-
- for (int n = kThreadCount - 1; n >= 0; --n) {
- LockGuard<Mutex> lock_guard(&threads[n].mutex_);
- EXPECT_TRUE(threads[n].running_);
- EXPECT_FALSE(threads[n].finished_);
- }
-
- for (int n = 0; n < kThreadCount; ++n) {
- LockGuard<Mutex> lock_guard(&threads[n].mutex_);
- EXPECT_TRUE(threads[n].running_);
- EXPECT_FALSE(threads[n].finished_);
- // Tell the nth thread to quit.
- threads[n].running_ = false;
- threads[n].cv_.NotifyOne();
- }
-
- for (int n = kThreadCount - 1; n >= 0; --n) {
- // Wait for nth thread to quit.
- LockGuard<Mutex> lock_guard(&threads[n].mutex_);
- while (!threads[n].finished_) {
- threads[n].cv_.Wait(&threads[n].mutex_);
- }
- EXPECT_FALSE(threads[n].running_);
- EXPECT_TRUE(threads[n].finished_);
- }
-
- for (int n = 0; n < kThreadCount; ++n) {
- threads[n].Join();
- LockGuard<Mutex> lock_guard(&threads[n].mutex_);
- EXPECT_FALSE(threads[n].running_);
- EXPECT_TRUE(threads[n].finished_);
- }
-}
-
-
-namespace {
-
-class ThreadWithSharedMutexAndConditionVariable V8_FINAL : public Thread {
- public:
- ThreadWithSharedMutexAndConditionVariable()
- : Thread(Options("ThreadWithSharedMutexAndConditionVariable")),
- running_(false),
- finished_(false),
- cv_(NULL),
- mutex_(NULL) {}
- virtual ~ThreadWithSharedMutexAndConditionVariable() {}
-
- virtual void Run() V8_OVERRIDE {
- LockGuard<Mutex> lock_guard(mutex_);
- running_ = true;
- cv_->NotifyAll();
- while (running_) {
- cv_->Wait(mutex_);
- }
- finished_ = true;
- cv_->NotifyAll();
- }
-
- bool running_;
- bool finished_;
- ConditionVariable* cv_;
- Mutex* mutex_;
-};
-
-}
-
-
-TEST(ConditionVariable,
MultipleThreadsWithSharedSeparateConditionVariables) {
- static const int kThreadCount = 128;
- ThreadWithSharedMutexAndConditionVariable threads[kThreadCount];
- ConditionVariable cv;
- Mutex mutex;
-
- for (int n = 0; n < kThreadCount; ++n) {
- threads[n].mutex_ = &mutex;
- threads[n].cv_ = &cv;
- }
-
- // Start all threads.
- {
- LockGuard<Mutex> lock_guard(&mutex);
- for (int n = 0; n < kThreadCount; ++n) {
- EXPECT_FALSE(threads[n].running_);
- EXPECT_FALSE(threads[n].finished_);
- threads[n].Start();
- }
- }
-
- // Wait for all threads to start.
- {
- LockGuard<Mutex> lock_guard(&mutex);
- for (int n = kThreadCount - 1; n >= 0; --n) {
- while (!threads[n].running_) {
- cv.Wait(&mutex);
- }
- }
- }
-
- // Make sure that all threads are running.
- {
- LockGuard<Mutex> lock_guard(&mutex);
- for (int n = 0; n < kThreadCount; ++n) {
- EXPECT_TRUE(threads[n].running_);
- EXPECT_FALSE(threads[n].finished_);
- }
- }
-
- // Tell all threads to quit.
- {
- LockGuard<Mutex> lock_guard(&mutex);
- for (int n = kThreadCount - 1; n >= 0; --n) {
- EXPECT_TRUE(threads[n].running_);
- EXPECT_FALSE(threads[n].finished_);
- // Tell the nth thread to quit.
- threads[n].running_ = false;
- }
- cv.NotifyAll();
- }
-
- // Wait for all threads to quit.
- {
- LockGuard<Mutex> lock_guard(&mutex);
- for (int n = 0; n < kThreadCount; ++n) {
- while (!threads[n].finished_) {
- cv.Wait(&mutex);
- }
- }
- }
-
- // Make sure all threads are finished.
- {
- LockGuard<Mutex> lock_guard(&mutex);
- for (int n = kThreadCount - 1; n >= 0; --n) {
- EXPECT_FALSE(threads[n].running_);
- EXPECT_TRUE(threads[n].finished_);
- }
- }
-
- // Join all threads.
- for (int n = 0; n < kThreadCount; ++n) {
- threads[n].Join();
- }
-}
-
-
-namespace {
-
-class LoopIncrementThread V8_FINAL : public Thread {
- public:
- LoopIncrementThread(int rem, int* counter, int limit, int thread_count,
- ConditionVariable* cv, Mutex* mutex)
- : Thread(Options("LoopIncrementThread")),
- rem_(rem),
- counter_(counter),
- limit_(limit),
- thread_count_(thread_count),
- cv_(cv),
- mutex_(mutex) {
- EXPECT_LT(rem, thread_count);
- EXPECT_EQ(0, limit % thread_count);
- }
-
- virtual void Run() V8_OVERRIDE {
- int last_count = -1;
- while (true) {
- LockGuard<Mutex> lock_guard(mutex_);
- int count = *counter_;
- while (count % thread_count_ != rem_ && count < limit_) {
- cv_->Wait(mutex_);
- count = *counter_;
- }
- if (count >= limit_) break;
- EXPECT_EQ(*counter_, count);
- if (last_count != -1) {
- EXPECT_EQ(last_count + (thread_count_ - 1), count);
- }
- count++;
- *counter_ = count;
- last_count = count;
- cv_->NotifyAll();
- }
- }
-
- private:
- const int rem_;
- int* counter_;
- const int limit_;
- const int thread_count_;
- ConditionVariable* cv_;
- Mutex* mutex_;
-};
-
-}
-
-
-TEST(ConditionVariable, LoopIncrement) {
- static const int kMaxThreadCount = 16;
- Mutex mutex;
- ConditionVariable cv;
- for (int thread_count = 1; thread_count < kMaxThreadCount;
++thread_count) {
- int limit = thread_count * 10;
- int counter = 0;
-
- // Setup the threads.
- Thread** threads = new Thread*[thread_count];
- for (int n = 0; n < thread_count; ++n) {
- threads[n] = new LoopIncrementThread(
- n, &counter, limit, thread_count, &cv, &mutex);
- }
-
- // Start all threads.
- for (int n = thread_count - 1; n >= 0; --n) {
- threads[n]->Start();
- }
-
- // Join and cleanup all threads.
- for (int n = 0; n < thread_count; ++n) {
- threads[n]->Join();
- delete threads[n];
- }
- delete[] threads;
-
- EXPECT_EQ(limit, counter);
- }
-}
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/platform/mutex-unittest.cc Thu Aug 7
08:39:21 2014 UTC
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/base/platform/mutex.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace base {
-
-TEST(Mutex, LockGuardMutex) {
- Mutex mutex;
- { LockGuard<Mutex> lock_guard(&mutex); }
- { LockGuard<Mutex> lock_guard(&mutex); }
-}
-
-
-TEST(Mutex, LockGuardRecursiveMutex) {
- RecursiveMutex recursive_mutex;
- { LockGuard<RecursiveMutex> lock_guard(&recursive_mutex); }
- {
- LockGuard<RecursiveMutex> lock_guard1(&recursive_mutex);
- LockGuard<RecursiveMutex> lock_guard2(&recursive_mutex);
- }
-}
-
-
-TEST(Mutex, LockGuardLazyMutex) {
- LazyMutex lazy_mutex = LAZY_MUTEX_INITIALIZER;
- { LockGuard<Mutex> lock_guard(lazy_mutex.Pointer()); }
- { LockGuard<Mutex> lock_guard(lazy_mutex.Pointer()); }
-}
-
-
-TEST(Mutex, LockGuardLazyRecursiveMutex) {
- LazyRecursiveMutex lazy_recursive_mutex =
LAZY_RECURSIVE_MUTEX_INITIALIZER;
- { LockGuard<RecursiveMutex> lock_guard(lazy_recursive_mutex.Pointer()); }
- {
- LockGuard<RecursiveMutex> lock_guard1(lazy_recursive_mutex.Pointer());
- LockGuard<RecursiveMutex> lock_guard2(lazy_recursive_mutex.Pointer());
- }
-}
-
-
-TEST(Mutex, MultipleMutexes) {
- Mutex mutex1;
- Mutex mutex2;
- Mutex mutex3;
- // Order 1
- mutex1.Lock();
- mutex2.Lock();
- mutex3.Lock();
- mutex1.Unlock();
- mutex2.Unlock();
- mutex3.Unlock();
- // Order 2
- mutex1.Lock();
- mutex2.Lock();
- mutex3.Lock();
- mutex3.Unlock();
- mutex2.Unlock();
- mutex1.Unlock();
-}
-
-
-TEST(Mutex, MultipleRecursiveMutexes) {
- RecursiveMutex recursive_mutex1;
- RecursiveMutex recursive_mutex2;
- // Order 1
- recursive_mutex1.Lock();
- recursive_mutex2.Lock();
- EXPECT_TRUE(recursive_mutex1.TryLock());
- EXPECT_TRUE(recursive_mutex2.TryLock());
- recursive_mutex1.Unlock();
- recursive_mutex1.Unlock();
- recursive_mutex2.Unlock();
- recursive_mutex2.Unlock();
- // Order 2
- recursive_mutex1.Lock();
- EXPECT_TRUE(recursive_mutex1.TryLock());
- recursive_mutex2.Lock();
- EXPECT_TRUE(recursive_mutex2.TryLock());
- recursive_mutex2.Unlock();
- recursive_mutex1.Unlock();
- recursive_mutex2.Unlock();
- recursive_mutex1.Unlock();
-}
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/platform/platform-unittest.cc Thu Aug 28
00:05:02 2014 UTC
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/base/platform/platform.h"
-
-#if V8_OS_POSIX
-#include <unistd.h> // NOLINT
-#endif
-
-#if V8_OS_WIN
-#include "src/base/win32-headers.h"
-#endif
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace base {
-
-TEST(OS, GetCurrentProcessId) {
-#if V8_OS_POSIX
- EXPECT_EQ(static_cast<int>(getpid()), OS::GetCurrentProcessId());
-#endif
-
-#if V8_OS_WIN
- EXPECT_EQ(static_cast<int>(::GetCurrentProcessId()),
- OS::GetCurrentProcessId());
-#endif
-}
-
-
-namespace {
-
-class SelfJoinThread V8_FINAL : public Thread {
- public:
- SelfJoinThread() : Thread(Options("SelfJoinThread")) {}
- virtual void Run() V8_OVERRIDE { Join(); }
-};
-
-}
-
-
-TEST(Thread, SelfJoin) {
- SelfJoinThread thread;
- thread.Start();
- thread.Join();
-}
-
-
-namespace {
-
-class ThreadLocalStorageTest : public Thread, public ::testing::Test {
- public:
- ThreadLocalStorageTest() : Thread(Options("ThreadLocalStorageTest")) {
- for (size_t i = 0; i < arraysize(keys_); ++i) {
- keys_[i] = Thread::CreateThreadLocalKey();
- }
- }
- ~ThreadLocalStorageTest() {
- for (size_t i = 0; i < arraysize(keys_); ++i) {
- Thread::DeleteThreadLocalKey(keys_[i]);
- }
- }
-
- virtual void Run() V8_FINAL V8_OVERRIDE {
- for (size_t i = 0; i < arraysize(keys_); i++) {
- CHECK(!Thread::HasThreadLocal(keys_[i]));
- }
- for (size_t i = 0; i < arraysize(keys_); i++) {
- Thread::SetThreadLocal(keys_[i], GetValue(i));
- }
- for (size_t i = 0; i < arraysize(keys_); i++) {
- CHECK(Thread::HasThreadLocal(keys_[i]));
- }
- for (size_t i = 0; i < arraysize(keys_); i++) {
- CHECK_EQ(GetValue(i), Thread::GetThreadLocal(keys_[i]));
- CHECK_EQ(GetValue(i), Thread::GetExistingThreadLocal(keys_[i]));
- }
- for (size_t i = 0; i < arraysize(keys_); i++) {
- Thread::SetThreadLocal(keys_[i], GetValue(arraysize(keys_) - i - 1));
- }
- for (size_t i = 0; i < arraysize(keys_); i++) {
- CHECK(Thread::HasThreadLocal(keys_[i]));
- }
- for (size_t i = 0; i < arraysize(keys_); i++) {
- CHECK_EQ(GetValue(arraysize(keys_) - i - 1),
- Thread::GetThreadLocal(keys_[i]));
- CHECK_EQ(GetValue(arraysize(keys_) - i - 1),
- Thread::GetExistingThreadLocal(keys_[i]));
- }
- }
-
- private:
- static void* GetValue(size_t x) {
- return reinterpret_cast<void*>(static_cast<uintptr_t>(x + 1));
- }
-
- Thread::LocalStorageKey keys_[256];
-};
-
-}
-
-
-TEST_F(ThreadLocalStorageTest, DoTest) {
- Run();
- Start();
- Join();
-}
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/platform/semaphore-unittest.cc Sun Aug 24
11:34:17 2014 UTC
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <cstring>
-
-#include "src/base/platform/platform.h"
-#include "src/base/platform/semaphore.h"
-#include "src/base/platform/time.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace base {
-
-namespace {
-
-static const char kAlphabet[] = "XKOAD";
-static const size_t kAlphabetSize = sizeof(kAlphabet) - 1;
-static const size_t kBufferSize = 987; // GCD(buffer size, alphabet size)
= 1
-static const size_t kDataSize = kBufferSize * kAlphabetSize * 10;
-
-
-class ProducerThread V8_FINAL : public Thread {
- public:
- ProducerThread(char* buffer, Semaphore* free_space, Semaphore*
used_space)
- : Thread(Options("ProducerThread")),
- buffer_(buffer),
- free_space_(free_space),
- used_space_(used_space) {}
- virtual ~ProducerThread() {}
-
- virtual void Run() V8_OVERRIDE {
- for (size_t n = 0; n < kDataSize; ++n) {
- free_space_->Wait();
- buffer_[n % kBufferSize] = kAlphabet[n % kAlphabetSize];
- used_space_->Signal();
- }
- }
-
- private:
- char* buffer_;
- Semaphore* const free_space_;
- Semaphore* const used_space_;
-};
-
-
-class ConsumerThread V8_FINAL : public Thread {
- public:
- ConsumerThread(const char* buffer, Semaphore* free_space,
- Semaphore* used_space)
- : Thread(Options("ConsumerThread")),
- buffer_(buffer),
- free_space_(free_space),
- used_space_(used_space) {}
- virtual ~ConsumerThread() {}
-
- virtual void Run() V8_OVERRIDE {
- for (size_t n = 0; n < kDataSize; ++n) {
- used_space_->Wait();
- EXPECT_EQ(kAlphabet[n % kAlphabetSize], buffer_[n % kBufferSize]);
- free_space_->Signal();
- }
- }
-
- private:
- const char* buffer_;
- Semaphore* const free_space_;
- Semaphore* const used_space_;
-};
-
-
-class WaitAndSignalThread V8_FINAL : public Thread {
- public:
- explicit WaitAndSignalThread(Semaphore* semaphore)
- : Thread(Options("WaitAndSignalThread")), semaphore_(semaphore) {}
- virtual ~WaitAndSignalThread() {}
-
- virtual void Run() V8_OVERRIDE {
- for (int n = 0; n < 100; ++n) {
- semaphore_->Wait();
- ASSERT_FALSE(semaphore_->WaitFor(TimeDelta::FromMicroseconds(1)));
- semaphore_->Signal();
- }
- }
-
- private:
- Semaphore* const semaphore_;
-};
-
-} // namespace
-
-
-TEST(Semaphore, ProducerConsumer) {
- char buffer[kBufferSize];
- std::memset(buffer, 0, sizeof(buffer));
- Semaphore free_space(kBufferSize);
- Semaphore used_space(0);
- ProducerThread producer_thread(buffer, &free_space, &used_space);
- ConsumerThread consumer_thread(buffer, &free_space, &used_space);
- producer_thread.Start();
- consumer_thread.Start();
- producer_thread.Join();
- consumer_thread.Join();
-}
-
-
-TEST(Semaphore, WaitAndSignal) {
- Semaphore semaphore(0);
- WaitAndSignalThread t1(&semaphore);
- WaitAndSignalThread t2(&semaphore);
-
- t1.Start();
- t2.Start();
-
- // Make something available.
- semaphore.Signal();
-
- t1.Join();
- t2.Join();
-
- semaphore.Wait();
-
- EXPECT_FALSE(semaphore.WaitFor(TimeDelta::FromMicroseconds(1)));
-}
-
-
-TEST(Semaphore, WaitFor) {
- Semaphore semaphore(0);
-
- // Semaphore not signalled - timeout.
- ASSERT_FALSE(semaphore.WaitFor(TimeDelta::FromMicroseconds(0)));
- ASSERT_FALSE(semaphore.WaitFor(TimeDelta::FromMicroseconds(100)));
- ASSERT_FALSE(semaphore.WaitFor(TimeDelta::FromMicroseconds(1000)));
-
- // Semaphore signalled - no timeout.
- semaphore.Signal();
- ASSERT_TRUE(semaphore.WaitFor(TimeDelta::FromMicroseconds(0)));
- semaphore.Signal();
- ASSERT_TRUE(semaphore.WaitFor(TimeDelta::FromMicroseconds(100)));
- semaphore.Signal();
- ASSERT_TRUE(semaphore.WaitFor(TimeDelta::FromMicroseconds(1000)));
-}
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/platform/time-unittest.cc Thu Aug 7
08:39:21 2014 UTC
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/base/platform/time.h"
-
-#if V8_OS_MACOSX
-#include <mach/mach_time.h>
-#endif
-#if V8_OS_POSIX
-#include <sys/time.h>
-#endif
-
-#if V8_OS_WIN
-#include "src/base/win32-headers.h"
-#endif
-
-#include "src/base/platform/elapsed-timer.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace base {
-
-TEST(TimeDelta, FromAndIn) {
- EXPECT_EQ(TimeDelta::FromDays(2), TimeDelta::FromHours(48));
- EXPECT_EQ(TimeDelta::FromHours(3), TimeDelta::FromMinutes(180));
- EXPECT_EQ(TimeDelta::FromMinutes(2), TimeDelta::FromSeconds(120));
- EXPECT_EQ(TimeDelta::FromSeconds(2), TimeDelta::FromMilliseconds(2000));
- EXPECT_EQ(TimeDelta::FromMilliseconds(2),
TimeDelta::FromMicroseconds(2000));
- EXPECT_EQ(static_cast<int>(13), TimeDelta::FromDays(13).InDays());
- EXPECT_EQ(static_cast<int>(13), TimeDelta::FromHours(13).InHours());
- EXPECT_EQ(static_cast<int>(13), TimeDelta::FromMinutes(13).InMinutes());
- EXPECT_EQ(static_cast<int64_t>(13),
TimeDelta::FromSeconds(13).InSeconds());
- EXPECT_DOUBLE_EQ(13.0, TimeDelta::FromSeconds(13).InSecondsF());
- EXPECT_EQ(static_cast<int64_t>(13),
- TimeDelta::FromMilliseconds(13).InMilliseconds());
- EXPECT_DOUBLE_EQ(13.0,
TimeDelta::FromMilliseconds(13).InMillisecondsF());
- EXPECT_EQ(static_cast<int64_t>(13),
- TimeDelta::FromMicroseconds(13).InMicroseconds());
-}
-
-
-#if V8_OS_MACOSX
-TEST(TimeDelta, MachTimespec) {
- TimeDelta null = TimeDelta();
- EXPECT_EQ(null, TimeDelta::FromMachTimespec(null.ToMachTimespec()));
- TimeDelta delta1 = TimeDelta::FromMilliseconds(42);
- EXPECT_EQ(delta1, TimeDelta::FromMachTimespec(delta1.ToMachTimespec()));
- TimeDelta delta2 = TimeDelta::FromDays(42);
- EXPECT_EQ(delta2, TimeDelta::FromMachTimespec(delta2.ToMachTimespec()));
-}
-#endif
-
-
-TEST(Time, JsTime) {
- Time t = Time::FromJsTime(700000.3);
- EXPECT_DOUBLE_EQ(700000.3, t.ToJsTime());
-}
-
-
-#if V8_OS_POSIX
-TEST(Time, Timespec) {
- Time null;
- EXPECT_TRUE(null.IsNull());
- EXPECT_EQ(null, Time::FromTimespec(null.ToTimespec()));
- Time now = Time::Now();
- EXPECT_EQ(now, Time::FromTimespec(now.ToTimespec()));
- Time now_sys = Time::NowFromSystemTime();
- EXPECT_EQ(now_sys, Time::FromTimespec(now_sys.ToTimespec()));
- Time unix_epoch = Time::UnixEpoch();
- EXPECT_EQ(unix_epoch, Time::FromTimespec(unix_epoch.ToTimespec()));
- Time max = Time::Max();
- EXPECT_TRUE(max.IsMax());
- EXPECT_EQ(max, Time::FromTimespec(max.ToTimespec()));
-}
-
-
-TEST(Time, Timeval) {
- Time null;
- EXPECT_TRUE(null.IsNull());
- EXPECT_EQ(null, Time::FromTimeval(null.ToTimeval()));
- Time now = Time::Now();
- EXPECT_EQ(now, Time::FromTimeval(now.ToTimeval()));
- Time now_sys = Time::NowFromSystemTime();
- EXPECT_EQ(now_sys, Time::FromTimeval(now_sys.ToTimeval()));
- Time unix_epoch = Time::UnixEpoch();
- EXPECT_EQ(unix_epoch, Time::FromTimeval(unix_epoch.ToTimeval()));
- Time max = Time::Max();
- EXPECT_TRUE(max.IsMax());
- EXPECT_EQ(max, Time::FromTimeval(max.ToTimeval()));
-}
-#endif
-
-
-#if V8_OS_WIN
-TEST(Time, Filetime) {
- Time null;
- EXPECT_TRUE(null.IsNull());
- EXPECT_EQ(null, Time::FromFiletime(null.ToFiletime()));
- Time now = Time::Now();
- EXPECT_EQ(now, Time::FromFiletime(now.ToFiletime()));
- Time now_sys = Time::NowFromSystemTime();
- EXPECT_EQ(now_sys, Time::FromFiletime(now_sys.ToFiletime()));
- Time unix_epoch = Time::UnixEpoch();
- EXPECT_EQ(unix_epoch, Time::FromFiletime(unix_epoch.ToFiletime()));
- Time max = Time::Max();
- EXPECT_TRUE(max.IsMax());
- EXPECT_EQ(max, Time::FromFiletime(max.ToFiletime()));
-}
-#endif
-
-
-namespace {
-
-template <typename T>
-static void ResolutionTest(T (*Now)(), TimeDelta target_granularity) {
- // We're trying to measure that intervals increment in a VERY small
amount
- // of time -- according to the specified target granularity.
Unfortunately,
- // if we happen to have a context switch in the middle of our test, the
- // context switch could easily exceed our limit. So, we iterate on this
- // several times. As long as we're able to detect the fine-granularity
- // timers at least once, then the test has succeeded.
- static const TimeDelta kExpirationTimeout = TimeDelta::FromSeconds(1);
- ElapsedTimer timer;
- timer.Start();
- TimeDelta delta;
- do {
- T start = Now();
- T now = start;
- // Loop until we can detect that the clock has changed. Non-HighRes
timers
- // will increment in chunks, i.e. 15ms. By spinning until we see a
clock
- // change, we detect the minimum time between measurements.
- do {
- now = Now();
- delta = now - start;
- } while (now <= start);
- EXPECT_NE(static_cast<int64_t>(0), delta.InMicroseconds());
- } while (delta > target_granularity
&& !timer.HasExpired(kExpirationTimeout));
- EXPECT_LE(delta, target_granularity);
-}
-
-}
-
-
-TEST(Time, NowResolution) {
- // We assume that Time::Now() has at least 16ms resolution.
- static const TimeDelta kTargetGranularity =
TimeDelta::FromMilliseconds(16);
- ResolutionTest<Time>(&Time::Now, kTargetGranularity);
-}
-
-
-TEST(TimeTicks, NowResolution) {
- // We assume that TimeTicks::Now() has at least 16ms resolution.
- static const TimeDelta kTargetGranularity =
TimeDelta::FromMilliseconds(16);
- ResolutionTest<TimeTicks>(&TimeTicks::Now, kTargetGranularity);
-}
-
-
-TEST(TimeTicks, HighResolutionNowResolution) {
- if (!TimeTicks::IsHighResolutionClockWorking()) return;
-
- // We assume that TimeTicks::HighResolutionNow() has sub-ms resolution.
- static const TimeDelta kTargetGranularity =
TimeDelta::FromMilliseconds(1);
- ResolutionTest<TimeTicks>(&TimeTicks::HighResolutionNow,
kTargetGranularity);
-}
-
-
-TEST(TimeTicks, IsMonotonic) {
- TimeTicks previous_normal_ticks;
- TimeTicks previous_highres_ticks;
- ElapsedTimer timer;
- timer.Start();
- while (!timer.HasExpired(TimeDelta::FromMilliseconds(100))) {
- TimeTicks normal_ticks = TimeTicks::Now();
- TimeTicks highres_ticks = TimeTicks::HighResolutionNow();
- EXPECT_GE(normal_ticks, previous_normal_ticks);
- EXPECT_GE((normal_ticks - previous_normal_ticks).InMicroseconds(), 0);
- EXPECT_GE(highres_ticks, previous_highres_ticks);
- EXPECT_GE((highres_ticks - previous_highres_ticks).InMicroseconds(),
0);
- previous_normal_ticks = normal_ticks;
- previous_highres_ticks = highres_ticks;
- }
-}
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/sys-info-unittest.cc Thu Aug 28 07:03:22
2014 UTC
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/base/sys-info.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-#if V8_OS_NACL
-#define DISABLE_ON_NACL(Name) DISABLED_##Name
-#else
-#define DISABLE_ON_NACL(Name) Name
-#endif
-
-namespace v8 {
-namespace base {
-
-TEST(SysInfoTest, NumberOfProcessors) {
- EXPECT_LT(0, SysInfo::NumberOfProcessors());
-}
-
-
-TEST(SysInfoTest, DISABLE_ON_NACL(AmountOfPhysicalMemory)) {
- EXPECT_LT(0, SysInfo::AmountOfPhysicalMemory());
-}
-
-
-TEST(SysInfoTest, AmountOfVirtualMemory) {
- EXPECT_LE(0, SysInfo::AmountOfVirtualMemory());
-}
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/test/base-unittests/utils/random-number-generator-unittest.cc
Thu Aug 7 08:39:21 2014 UTC
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <climits>
-
-#include "src/base/utils/random-number-generator.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace base {
-
-class RandomNumberGeneratorTest : public ::testing::TestWithParam<int> {};
-
-
-static const int kMaxRuns = 12345;
-
-
-TEST_P(RandomNumberGeneratorTest, NextIntWithMaxValue) {
- RandomNumberGenerator rng(GetParam());
- for (int max = 1; max <= kMaxRuns; ++max) {
- int n = rng.NextInt(max);
- EXPECT_LE(0, n);
- EXPECT_LT(n, max);
- }
-}
-
-
-TEST_P(RandomNumberGeneratorTest, NextBooleanReturnsFalseOrTrue) {
- RandomNumberGenerator rng(GetParam());
- for (int k = 0; k < kMaxRuns; ++k) {
- bool b = rng.NextBool();
- EXPECT_TRUE(b == false || b == true);
- }
-}
-
-
-TEST_P(RandomNumberGeneratorTest, NextDoubleReturnsValueBetween0And1) {
- RandomNumberGenerator rng(GetParam());
- for (int k = 0; k < kMaxRuns; ++k) {
- double d = rng.NextDouble();
- EXPECT_LE(0.0, d);
- EXPECT_LT(d, 1.0);
- }
-}
-
-
-INSTANTIATE_TEST_CASE_P(RandomSeeds, RandomNumberGeneratorTest,
- ::testing::Values(INT_MIN, -1, 0, 1, 42, 100,
- 1234567890, 987654321, INT_MAX));
-
-} // namespace base
-} // namespace v8
=======================================
--- /trunk/BUILD.gn Fri Aug 29 00:04:38 2014 UTC
+++ /trunk/BUILD.gn Mon Sep 1 00:05:43 2014 UTC
@@ -732,6 +732,8 @@
"src/ic/stub-cache.h",
"src/interface.cc",
"src/interface.h",
+ "src/interface-descriptors.cc",
+ "src/interface-descriptors.h",
"src/interpreter-irregexp.cc",
"src/interpreter-irregexp.h",
"src/isolate.cc",
@@ -889,6 +891,7 @@
"src/ia32/frames-ia32.cc",
"src/ia32/frames-ia32.h",
"src/ia32/full-codegen-ia32.cc",
+ "src/ia32/interface-descriptors-ia32.cc",
"src/ia32/lithium-codegen-ia32.cc",
"src/ia32/lithium-codegen-ia32.h",
"src/ia32/lithium-gap-resolver-ia32.cc",
@@ -925,6 +928,7 @@
"src/x64/frames-x64.cc",
"src/x64/frames-x64.h",
"src/x64/full-codegen-x64.cc",
+ "src/x64/interface-descriptors-x64.cc",
"src/x64/lithium-codegen-x64.cc",
"src/x64/lithium-codegen-x64.h",
"src/x64/lithium-gap-resolver-x64.cc",
@@ -965,6 +969,8 @@
"src/arm/frames-arm.cc",
"src/arm/frames-arm.h",
"src/arm/full-codegen-arm.cc",
+ "src/arm/interface-descriptors-arm.cc",
+ "src/arm/interface-descriptors-arm.h",
"src/arm/lithium-arm.cc",
"src/arm/lithium-arm.h",
"src/arm/lithium-codegen-arm.cc",
@@ -1013,6 +1019,8 @@
"src/arm64/instructions-arm64.h",
"src/arm64/instrument-arm64.cc",
"src/arm64/instrument-arm64.h",
+ "src/arm64/interface-descriptors-arm64.cc",
+ "src/arm64/interface-descriptors-arm64.h",
"src/arm64/lithium-arm64.cc",
"src/arm64/lithium-arm64.h",
"src/arm64/lithium-codegen-arm64.cc",
@@ -1058,6 +1066,7 @@
"src/mips/frames-mips.cc",
"src/mips/frames-mips.h",
"src/mips/full-codegen-mips.cc",
+ "src/mips/interface-descriptors-mips.cc",
"src/mips/lithium-codegen-mips.cc",
"src/mips/lithium-codegen-mips.h",
"src/mips/lithium-gap-resolver-mips.cc",
@@ -1095,6 +1104,7 @@
"src/mips64/frames-mips64.cc",
"src/mips64/frames-mips64.h",
"src/mips64/full-codegen-mips64.cc",
+ "src/mips64/interface-descriptors-mips64.cc",
"src/mips64/lithium-codegen-mips64.cc",
"src/mips64/lithium-codegen-mips64.h",
"src/mips64/lithium-gap-resolver-mips64.cc",
=======================================
--- /trunk/ChangeLog Fri Aug 29 00:04:38 2014 UTC
+++ /trunk/ChangeLog Mon Sep 1 00:05:43 2014 UTC
@@ -1,3 +1,8 @@
+2014-09-01: Version 3.29.35
+
+ Performance and stability improvements on all platforms.
+
+
2014-08-29: Version 3.29.29
Performance and stability improvements on all platforms.
=======================================
--- /trunk/build/all.gyp Wed Aug 20 00:06:26 2014 UTC
+++ /trunk/build/all.gyp Mon Sep 1 00:05:43 2014 UTC
@@ -9,8 +9,8 @@
'type': 'none',
'dependencies': [
'../samples/samples.gyp:*',
+ '../src/base/base.gyp:*',
'../src/d8.gyp:d8',
- '../test/base-unittests/base-unittests.gyp:*',
'../test/cctest/cctest.gyp:*',
'../test/compiler-unittests/compiler-unittests.gyp:*',
'../test/heap-unittests/heap-unittests.gyp:*',
=======================================
--- /trunk/src/DEPS Wed Aug 6 00:06:29 2014 UTC
+++ /trunk/src/DEPS Mon Sep 1 00:05:43 2014 UTC
@@ -4,6 +4,7 @@
"+src/compiler/pipeline.h",
"-src/libplatform",
"-include/libplatform",
+ "+testing",
]
specific_include_rules = {
=======================================
--- /trunk/src/arm/code-stubs-arm.cc Thu Aug 28 07:03:22 2014 UTC
+++ /trunk/src/arm/code-stubs-arm.cc Mon Sep 1 00:05:43 2014 UTC
@@ -131,9 +131,6 @@
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
}
-
-
-const Register InterfaceDescriptor::ContextRegister() { return cp; }
static void InitializeArrayConstructorDescriptor(
@@ -268,91 +265,6 @@
descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
-
-
-void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
- static PlatformInterfaceDescriptor default_descriptor =
- PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
-
- static PlatformInterfaceDescriptor noInlineDescriptor =
- PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
-
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- Register registers[] = { cp, // context
- r1, // JSFunction
- r0, // actual number of arguments
- r2, // expected number of arguments
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // JSFunction
- Representation::Integer32(), // actual number of arguments
- Representation::Integer32(), // expected number of arguments
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &default_descriptor);
- }
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::KeyedCall);
- Register registers[] = { cp, // context
- r2, // key
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // key
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &noInlineDescriptor);
- }
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::NamedCall);
- Register registers[] = { cp, // context
- r2, // name
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // name
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &noInlineDescriptor);
- }
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::CallHandler);
- Register registers[] = { cp, // context
- r0, // receiver
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // receiver
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &default_descriptor);
- }
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::ApiFunctionCall);
- Register registers[] = { cp, // context
- r0, // callee
- r4, // call_data
- r2, // holder
- r1, // api_function_address
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // callee
- Representation::Tagged(), // call_data
- Representation::Tagged(), // holder
- Representation::External(), // api_function_address
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &default_descriptor);
- }
-}
#define __ ACCESS_MASM(masm)
=======================================
--- /trunk/src/arm/code-stubs-arm.h Mon Aug 25 19:57:56 2014 UTC
+++ /trunk/src/arm/code-stubs-arm.h Mon Sep 1 00:05:43 2014 UTC
@@ -402,20 +402,6 @@
LookupMode mode_;
};
-
-class PlatformInterfaceDescriptor {
- public:
- explicit PlatformInterfaceDescriptor(
- TargetAddressStorageMode storage_mode)
- : storage_mode_(storage_mode) { }
-
- TargetAddressStorageMode storage_mode() { return storage_mode_; }
-
- private:
- TargetAddressStorageMode storage_mode_;
-};
-
-
} } // namespace v8::internal
#endif // V8_ARM_CODE_STUBS_ARM_H_
=======================================
--- /trunk/src/arm64/code-stubs-arm64.cc Thu Aug 28 07:03:22 2014 UTC
+++ /trunk/src/arm64/code-stubs-arm64.cc Mon Sep 1 00:05:43 2014 UTC
@@ -158,9 +158,6 @@
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
}
-
-
-const Register InterfaceDescriptor::ContextRegister() { return cp; }
static void InitializeArrayConstructorDescriptor(
@@ -305,91 +302,6 @@
descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
-
-
-void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
- static PlatformInterfaceDescriptor default_descriptor =
- PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
-
- static PlatformInterfaceDescriptor noInlineDescriptor =
- PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
-
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- Register registers[] = { cp, // context
- x1, // JSFunction
- x0, // actual number of arguments
- x2, // expected number of arguments
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // JSFunction
- Representation::Integer32(), // actual number of arguments
- Representation::Integer32(), // expected number of arguments
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &default_descriptor);
- }
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::KeyedCall);
- Register registers[] = { cp, // context
- x2, // key
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // key
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &noInlineDescriptor);
- }
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::NamedCall);
- Register registers[] = { cp, // context
- x2, // name
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // name
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &noInlineDescriptor);
- }
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::CallHandler);
- Register registers[] = { cp, // context
- x0, // receiver
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // receiver
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &default_descriptor);
- }
- {
- CallInterfaceDescriptor* descriptor =
- isolate->call_descriptor(Isolate::ApiFunctionCall);
- Register registers[] = { cp, // context
- x0, // callee
- x4, // call_data
- x2, // holder
- x1, // api_function_address
- };
- Representation representations[] = {
- Representation::Tagged(), // context
- Representation::Tagged(), // callee
- Representation::Tagged(), // call_data
- Representation::Tagged(), // holder
- Representation::External(), // api_function_address
- };
- descriptor->Initialize(arraysize(registers), registers,
- representations, &default_descriptor);
- }
-}
#define __ ACCESS_MASM(masm)
=======================================
--- /trunk/src/arm64/code-stubs-arm64.h Mon Aug 25 19:57:56 2014 UTC
+++ /trunk/src/arm64/code-stubs-arm64.h Mon Sep 1 00:05:43 2014 UTC
@@ -454,20 +454,6 @@
Label* chars_not_equal);
};
-
-class PlatformInterfaceDescriptor {
- public:
- explicit PlatformInterfaceDescriptor(
- TargetAddressStorageMode storage_mode)
- : storage_mode_(storage_mode) { }
-
- TargetAddressStorageMode storage_mode() { return storage_mode_; }
-
- private:
- TargetAddressStorageMode storage_mode_;
-};
-
-
} } // namespace v8::internal
#endif // V8_ARM64_CODE_STUBS_ARM64_H_
=======================================
--- /trunk/src/arm64/decoder-arm64.cc Tue Aug 5 00:05:55 2014 UTC
+++ /trunk/src/arm64/decoder-arm64.cc Mon Sep 1 00:05:43 2014 UTC
@@ -17,13 +17,13 @@
void DispatchingDecoderVisitor::AppendVisitor(DecoderVisitor* new_visitor)
{
visitors_.remove(new_visitor);
- visitors_.push_front(new_visitor);
+ visitors_.push_back(new_visitor);
}
void DispatchingDecoderVisitor::PrependVisitor(DecoderVisitor*
new_visitor) {
visitors_.remove(new_visitor);
- visitors_.push_back(new_visitor);
+ visitors_.push_front(new_visitor);
}
=======================================
--- /trunk/src/arm64/macro-assembler-arm64.cc Fri Aug 8 15:46:17 2014 UTC
+++ /trunk/src/arm64/macro-assembler-arm64.cc Mon Sep 1 00:05:43 2014 UTC
@@ -3013,11 +3013,21 @@
void MacroAssembler::TruncateDoubleToI(Register result,
DoubleRegister double_input) {
Label done;
- DCHECK(jssp.Is(StackPointer()));
// Try to convert the double to an int64. If successful, the bottom 32
bits
// contain our truncated int32 result.
TryConvertDoubleToInt64(result, double_input, &done);
+
+ const Register old_stack_pointer = StackPointer();
+ if (csp.Is(old_stack_pointer)) {
+ // This currently only happens during compiler-unittest. If it arises
+ // during regular code generation the DoubleToI stub should be updated
to
+ // cope with csp and have an extra parameter indicating which stack
pointer
+ // it should use.
+ Push(jssp, xzr); // Push xzr to maintain csp required 16-bytes
alignment.
+ Mov(jssp, csp);
+ SetStackPointer(jssp);
+ }
// If we fell through then inline version didn't succeed - call stub
instead.
Push(lr, double_input);
@@ -3030,8 +3040,15 @@
true); // skip_fastpath
CallStub(&stub); // DoubleToIStub preserves any registers it needs to
clobber
- Drop(1, kDoubleSize); // Drop the double input on the stack.
- Pop(lr);
+ DCHECK_EQ(xzr.SizeInBytes(), double_input.SizeInBytes());
+ Pop(xzr, lr); // xzr to drop the double input on the stack.
+
+ if (csp.Is(old_stack_pointer)) {
+ Mov(csp, jssp);
+ SetStackPointer(csp);
+ AssertStackConsistency();
+ Pop(xzr, jssp);
+ }
Bind(&done);
}
=======================================
--- /trunk/src/base/platform/platform-linux.cc Tue Aug 5 00:05:55 2014 UTC
+++ /trunk/src/base/platform/platform-linux.cc Mon Sep 1 00:05:43 2014 UTC
@@ -9,9 +9,7 @@
#include <semaphore.h>
#include <signal.h>
#include <stdlib.h>
-#include <sys/prctl.h>
#include <sys/resource.h>
-#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -46,6 +44,15 @@
#include "src/base/macros.h"
#include "src/base/platform/platform.h"
+#if V8_OS_NACL
+#if !defined(MAP_NORESERVE)
+// PNaCL doesn't have this, so we always grab all of the memory, which is
bad.
+#define MAP_NORESERVE 0
+#endif
+#else
+#include <sys/prctl.h>
+#include <sys/syscall.h>
+#endif
namespace v8 {
namespace base {
@@ -95,20 +102,30 @@
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
+#if V8_OS_NACL
+ // Missing support for tm_zone field.
+ return "";
+#else
if (std::isnan(time)) return "";
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
struct tm* t = localtime(&tv);
if (NULL == t) return "";
return t->tm_zone;
+#endif
}
double OS::LocalTimeOffset(TimezoneCache* cache) {
+#if V8_OS_NACL
+ // Missing support for tm_zone field.
+ return 0;
+#else
time_t tv = time(NULL);
struct tm* t = localtime(&tv);
// tm_gmtoff includes any daylight savings offset, so subtract it.
return static_cast<double>(t->tm_gmtoff * msPerSecond -
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
+#endif
}
@@ -260,18 +277,15 @@
OS::PrintError("Failed to open %s\n", OS::GetGCFakeMMapFile());
OS::Abort();
}
- void* addr = mmap(OS::GetRandomMmapAddr(),
- size,
-#if defined(__native_client__)
+ void* addr = mmap(OS::GetRandomMmapAddr(), size,
+#if V8_OS_NACL
// The Native Client port of V8 uses an interpreter,
// so code pages don't need PROT_EXEC.
PROT_READ,
#else
PROT_READ | PROT_EXEC,
#endif
- MAP_PRIVATE,
- fileno(f),
- 0);
+ MAP_PRIVATE, fileno(f), 0);
DCHECK(addr != MAP_FAILED);
OS::Free(addr, size);
fclose(f);
@@ -387,7 +401,7 @@
bool VirtualMemory::CommitRegion(void* base, size_t size, bool
is_executable) {
-#if defined(__native_client__)
+#if V8_OS_NACL
// The Native Client port of V8 uses an interpreter,
// so code pages don't need PROT_EXEC.
int prot = PROT_READ | PROT_WRITE;
=======================================
--- /trunk/src/base/platform/platform-posix.cc Thu Aug 28 07:03:22 2014 UTC
+++ /trunk/src/base/platform/platform-posix.cc Mon Sep 1 00:05:43 2014 UTC
@@ -19,14 +19,8 @@
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
-#if !defined(__pnacl__)
-#include <sys/syscall.h>
-#endif
#include <sys/time.h>
#include <sys/types.h>
-#if defined(__linux__) && !defined(__pnacl__)
-#include <sys/prctl.h> // NOLINT, for prctl
-#endif
#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) |
| \
defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/sysctl.h> // NOLINT, for sysctl
@@ -56,6 +50,14 @@
#include <dlfcn.h>
#endif
+#if V8_OS_LINUX
+#include <sys/prctl.h> // NOLINT, for prctl
+#endif
+
+#if !V8_OS_NACL
+#include <sys/syscall.h>
+#endif
+
namespace v8 {
namespace base {
@@ -223,11 +225,11 @@
#elif V8_HOST_ARCH_MIPS64
asm("break");
#elif V8_HOST_ARCH_IA32
-#if defined(__native_client__)
+#if V8_OS_NACL
asm("hlt");
#else
asm("int $3");
-#endif // __native_client__
+#endif // V8_OS_NACL
#elif V8_HOST_ARCH_X64
asm("int $3");
#else
@@ -268,12 +270,17 @@
//
int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) {
+#if V8_OS_NACL
+ // Optionally used in Logger::ResourceEvent.
+ return -1;
+#else
struct rusage usage;
if (getrusage(RUSAGE_SELF, &usage) < 0) return -1;
*secs = usage.ru_utime.tv_sec;
*usecs = usage.ru_utime.tv_usec;
return 0;
+#endif
}
=======================================
--- /trunk/src/base/platform/semaphore.cc Tue Aug 5 00:05:55 2014 UTC
+++ /trunk/src/base/platform/semaphore.cc Mon Sep 1 00:05:43 2014 UTC
@@ -12,6 +12,7 @@
#include <errno.h>
#include "src/base/logging.h"
+#include "src/base/platform/elapsed-timer.h"
#include "src/base/platform/time.h"
namespace v8 {
@@ -106,6 +107,17 @@
bool Semaphore::WaitFor(const TimeDelta& rel_time) {
+#if V8_OS_NACL
+ // PNaCL doesn't support sem_timedwait, do ugly busy waiting.
+ ElapsedTimer timer;
+ timer.Start();
+ do {
+ int result = sem_trywait(&native_handle_);
+ if (result == 0) return true;
+ DCHECK(errno == EAGAIN || error == EINTR);
+ } while (!timer.HasExpired(rel_time));
+ return false;
+#else
// Compute the time for end of timeout.
const Time time = Time::NowFromSystemTime() + rel_time;
const struct timespec ts = time.ToTimespec();
@@ -129,6 +141,7 @@
DCHECK_EQ(-1, result);
DCHECK_EQ(EINTR, errno);
}
+#endif
}
#elif V8_OS_WIN
=======================================
--- /trunk/src/base/sys-info.cc Thu Aug 28 00:05:02 2014 UTC
+++ /trunk/src/base/sys-info.cc Mon Sep 1 00:05:43 2014 UTC
@@ -91,6 +91,9 @@
return 0;
}
return static_cast<int64_t>(stat_buf.st_size);
+#elif V8_OS_NACL
+ // No support for _SC_PHYS_PAGES, assume 2GB.
+ return static_cast<int64_t>(1) << 31;
#elif V8_OS_POSIX
long pages = sysconf(_SC_PHYS_PAGES); // NOLINT(runtime/int)
long page_size = sysconf(_SC_PAGESIZE); // NOLINT(runtime/int)
=======================================
--- /trunk/src/code-stubs.cc Thu Aug 28 09:24:16 2014 UTC
+++ /trunk/src/code-stubs.cc Mon Sep 1 00:05:43 2014 UTC
@@ -14,10 +14,6 @@
namespace v8 {
namespace internal {
-
-
-InterfaceDescriptor::InterfaceDescriptor()
- : register_param_count_(-1) { }
CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor()
@@ -28,38 +24,6 @@
handler_arguments_mode_(DONT_PASS_ARGUMENTS),
miss_handler_(),
has_miss_handler_(false) { }
-
-
-void InterfaceDescriptor::Initialize(
- int register_parameter_count,
- Register* registers,
- Representation* register_param_representations,
- PlatformInterfaceDescriptor* platform_descriptor) {
- platform_specific_descriptor_ = platform_descriptor;
- register_param_count_ = register_parameter_count;
-
- // An interface descriptor must have a context register.
- DCHECK(register_parameter_count > 0 &&
registers[0].is(ContextRegister()));
-
- // InterfaceDescriptor owns a copy of the registers array.
- register_params_.Reset(NewArray<Register>(register_parameter_count));
- for (int i = 0; i < register_parameter_count; i++) {
- register_params_[i] = registers[i];
- }
-
- // If a representations array is specified, then the descriptor owns
that as
- // well.
- if (register_param_representations != NULL) {
- register_param_representations_.Reset(
- NewArray<Representation>(register_parameter_count));
- for (int i = 0; i < register_parameter_count; i++) {
- // If there is a context register, the representation must be tagged.
- DCHECK(i != 0 || register_param_representations[i].Equals(
- Representation::Tagged()));
- register_param_representations_[i] =
register_param_representations[i];
- }
- }
-}
void CodeStubInterfaceDescriptor::Initialize(
@@ -90,16 +54,6 @@
stack_parameter_count_ = stack_parameter_count;
handler_arguments_mode_ = handler_mode;
}
-
-
-void CallInterfaceDescriptor::Initialize(
- int register_parameter_count,
- Register* registers,
- Representation* param_representations,
- PlatformInterfaceDescriptor* platform_descriptor) {
- InterfaceDescriptor::Initialize(register_parameter_count, registers,
- param_representations,
platform_descriptor);
-}
bool CodeStub::FindCodeInCache(Code** code_out) {
=======================================
--- /trunk/src/code-stubs.h Thu Aug 28 09:24:16 2014 UTC
+++ /trunk/src/code-stubs.h Mon Sep 1 00:05:43 2014 UTC
@@ -11,6 +11,7 @@
#include "src/globals.h"
#include "src/ic/ic.h"
#include "src/ic/ic-conventions.h"
+#include "src/interface-descriptors.h"
#include "src/macro-assembler.h"
#include "src/ostreams.h"
@@ -280,79 +281,6 @@
enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS };
-class PlatformInterfaceDescriptor;
-
-
-class InterfaceDescriptor {
- public:
- bool IsInitialized() const { return register_param_count_ >= 0; }
-
- int GetEnvironmentLength() const { return register_param_count_; }
-
- int GetRegisterParameterCount() const { return register_param_count_; }
-
- Register GetParameterRegister(int index) const {
- return register_params_[index];
- }
-
- Representation GetParameterRepresentation(int index) const {
- DCHECK(index < register_param_count_);
- if (register_param_representations_.get() == NULL) {
- return Representation::Tagged();
- }
-
- return register_param_representations_[index];
- }
-
- // "Environment" versions of parameter functions. The first register
- // parameter (context) is not included.
- int GetEnvironmentParameterCount() const {
- return GetEnvironmentLength() - 1;
- }
-
- Register GetEnvironmentParameterRegister(int index) const {
- return GetParameterRegister(index + 1);
- }
-
- Representation GetEnvironmentParameterRepresentation(int index) const {
- return GetParameterRepresentation(index + 1);
- }
-
- // Some platforms have extra information to associate with the
descriptor.
- PlatformInterfaceDescriptor* platform_specific_descriptor() const {
- return platform_specific_descriptor_;
- }
-
- static const Register ContextRegister();
-
- protected:
- InterfaceDescriptor();
- virtual ~InterfaceDescriptor() {}
-
- void Initialize(int register_parameter_count, Register* registers,
- Representation* register_param_representations,
- PlatformInterfaceDescriptor* platform_descriptor = NULL);
-
- private:
- int register_param_count_;
-
- // The Register params are allocated dynamically by the
- // InterfaceDescriptor, and freed on destruction. This is because static
- // arrays of Registers cause creation of runtime static initializers
- // which we don't want.
- SmartArrayPointer<Register> register_params_;
- // Specifies Representations for the stub's parameter. Points to an
array of
- // Representations of the same length of the numbers of parameters to the
- // stub, or if NULL (the default value), Representation of each parameter
- // assumed to be Tagged().
- SmartArrayPointer<Representation> register_param_representations_;
-
- PlatformInterfaceDescriptor* platform_specific_descriptor_;
-
- DISALLOW_COPY_AND_ASSIGN(InterfaceDescriptor);
-};
-
-
class CodeStubInterfaceDescriptor: public InterfaceDescriptor {
public:
CodeStubInterfaceDescriptor();
@@ -421,23 +349,6 @@
};
-class CallInterfaceDescriptor: public InterfaceDescriptor {
- public:
- CallInterfaceDescriptor() { }
-
- // A copy of the passed in registers and param_representations is made
- // and owned by the CallInterfaceDescriptor.
-
- // TODO(mvstanton): Instead of taking parallel arrays register and
- // param_representations, how about a struct that puts the representation
- // and register side by side (eg, RegRep(r1, Representation::Tagged()).
- // The same should go for the CodeStubInterfaceDescriptor class.
- void Initialize(int register_parameter_count, Register* registers,
- Representation* param_representations,
- PlatformInterfaceDescriptor* platform_descriptor = NULL);
-};
-
-
class HydrogenCodeStub : public CodeStub {
public:
enum InitializationState {
@@ -2659,11 +2570,6 @@
DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
};
-
-class CallDescriptors {
- public:
- static void InitializeForIsolate(Isolate* isolate);
-};
} } // namespace v8::internal
=======================================
--- /trunk/src/compiler/arm/code-generator-arm.cc Thu Aug 28 07:03:22 2014
UTC
+++ /trunk/src/compiler/arm/code-generator-arm.cc Mon Sep 1 00:05:43 2014
UTC
@@ -841,10 +841,10 @@
void CodeGenerator::AddNopForSmiCodeInlining() {
// On 32-bit ARM we do not insert nops for inlined Smi code.
- UNREACHABLE();
}
#undef __
-}
-}
-} // namespace v8::internal::compiler
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
=======================================
***Additional files exist in this changeset.***
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.