summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-01-14 16:42:13 +0000
committerBen Murdoch <benm@google.com>2011-01-14 16:42:13 +0000
commit1a80c996a0cb6c5ac739148352552ab47038ccc3 (patch)
tree49bd79c85eaee1acf422c9c497ed8088790441cc /src
parentdb5a90a88cfcddb042912799e872037c6548b8a3 (diff)
downloadandroid_external_v8-1a80c996a0cb6c5ac739148352552ab47038ccc3.tar.gz
android_external_v8-1a80c996a0cb6c5ac739148352552ab47038ccc3.tar.bz2
android_external_v8-1a80c996a0cb6c5ac739148352552ab47038ccc3.zip
Update V8 to r6333 (2.5 branch)
Note: we temporarily deviate from 9.0.597.x to pull v8 v2.5.9.9 Change-Id: I08d06e15a1a3af206fb23f98f56c81fe579e1a78 http://v8.googlecode.com/svn/branches/2.5@6333
Diffstat (limited to 'src')
-rw-r--r--src/api.cc52
-rw-r--r--src/arm/stub-cache-arm.cc4
-rw-r--r--src/platform-linux.cc29
-rw-r--r--src/version.cc2
4 files changed, 52 insertions, 35 deletions
diff --git a/src/api.cc b/src/api.cc
index 19af866c..b1fb88a0 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3243,18 +3243,35 @@ void v8::Object::SetInternalField(int index, v8::Handle<Value> value) {
}
+static bool CanBeEncodedAsSmi(void* ptr) {
+ const intptr_t address = reinterpret_cast<intptr_t>(ptr);
+ return ((address & i::kEncodablePointerMask) == 0);
+}
+
+
+static i::Smi* EncodeAsSmi(void* ptr) {
+ ASSERT(CanBeEncodedAsSmi(ptr));
+ const intptr_t address = reinterpret_cast<intptr_t>(ptr);
+ i::Smi* result = reinterpret_cast<i::Smi*>(address << i::kPointerToSmiShift);
+ ASSERT(i::Internals::HasSmiTag(result));
+ ASSERT_EQ(result, i::Smi::FromInt(result->value()));
+ ASSERT_EQ(ptr, i::Internals::GetExternalPointerFromSmi(result));
+ return result;
+}
+
+
void v8::Object::SetPointerInInternalField(int index, void* value) {
ENTER_V8;
- i::Object* as_object = reinterpret_cast<i::Object*>(value);
- if (as_object->IsSmi()) {
- Utils::OpenHandle(this)->SetInternalField(index, as_object);
- return;
+ if (CanBeEncodedAsSmi(value)) {
+ Utils::OpenHandle(this)->SetInternalField(index, EncodeAsSmi(value));
+ } else {
+ HandleScope scope;
+ i::Handle<i::Proxy> proxy =
+ i::Factory::NewProxy(reinterpret_cast<i::Address>(value), i::TENURED);
+ if (!proxy.is_null())
+ Utils::OpenHandle(this)->SetInternalField(index, *proxy);
}
- HandleScope scope;
- i::Handle<i::Proxy> proxy =
- i::Factory::NewProxy(reinterpret_cast<i::Address>(value), i::TENURED);
- if (!proxy.is_null())
- Utils::OpenHandle(this)->SetInternalField(index, *proxy);
+ ASSERT_EQ(value, GetPointerFromInternalField(index));
}
@@ -3537,11 +3554,13 @@ Local<Value> v8::External::Wrap(void* data) {
LOG_API("External::Wrap");
EnsureInitialized("v8::External::Wrap()");
ENTER_V8;
- i::Object* as_object = reinterpret_cast<i::Object*>(data);
- if (as_object->IsSmi()) {
- return Utils::ToLocal(i::Handle<i::Object>(as_object));
- }
- return ExternalNewImpl(data);
+
+ v8::Local<v8::Value> result = CanBeEncodedAsSmi(data)
+ ? Utils::ToLocal(i::Handle<i::Object>(EncodeAsSmi(data)))
+ : v8::Local<v8::Value>(ExternalNewImpl(data));
+
+ ASSERT_EQ(data, Unwrap(result));
+ return result;
}
@@ -3549,7 +3568,7 @@ void* v8::Object::SlowGetPointerFromInternalField(int index) {
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
i::Object* value = obj->GetInternalField(index);
if (value->IsSmi()) {
- return value;
+ return i::Internals::GetExternalPointerFromSmi(value);
} else if (value->IsProxy()) {
return reinterpret_cast<void*>(i::Proxy::cast(value)->proxy());
} else {
@@ -3563,8 +3582,7 @@ void* v8::External::FullUnwrap(v8::Handle<v8::Value> wrapper) {
i::Handle<i::Object> obj = Utils::OpenHandle(*wrapper);
void* result;
if (obj->IsSmi()) {
- // The external value was an aligned pointer.
- result = *obj;
+ result = i::Internals::GetExternalPointerFromSmi(*obj);
} else if (obj->IsProxy()) {
result = ExternalValueImpl(obj);
} else {
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc
index 0a5eac27..2117ce6b 100644
--- a/src/arm/stub-cache-arm.cc
+++ b/src/arm/stub-cache-arm.cc
@@ -1923,7 +1923,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
__ cmp(r7, Operand(HeapNumber::kMantissaBits));
// If greater or equal, the argument is already round and in r0.
__ b(&restore_fpscr_and_return, ge);
- __ b(&slow);
+ __ b(&wont_fit_smi);
__ bind(&no_vfp_exception);
// Move the result back to general purpose register r0.
@@ -1951,10 +1951,10 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
__ Ret();
__ bind(&wont_fit_smi);
- __ bind(&slow);
// Restore FPCSR and fall to slow case.
__ vmsr(r3);
+ __ bind(&slow);
// Tail call the full function. We do not have to patch the receiver
// because the function makes no use of it.
__ InvokeFunction(function, arguments(), JUMP_FUNCTION);
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index cb8e919e..cc7cbe5f 100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -133,9 +133,7 @@ static bool CPUInfoContainsString(const char * search_string) {
}
bool OS::ArmCpuHasFeature(CpuFeature feature) {
- const int max_items = 2;
- const char* search_strings[max_items] = { NULL, NULL };
- int search_items = 0;
+ const char* search_string = NULL;
// Simple detection of VFP at runtime for Linux.
// It is based on /proc/cpuinfo, which reveals hardware configuration
// to user-space applications. According to ARM (mid 2009), no similar
@@ -143,25 +141,26 @@ bool OS::ArmCpuHasFeature(CpuFeature feature) {
// so it's up to individual OSes to provide such.
switch (feature) {
case VFP3:
- search_strings[0] = "vfpv3";
- // Some old kernels will report vfp for A8, not vfpv3, so we check for
- // A8 explicitely. The cpuinfo file report the CPU Part which for Cortex
- // A8 is 0xc08.
- search_strings[1] = "0xc08";
- search_items = 2;
- ASSERT(search_items <= max_items);
+ search_string = "vfpv3";
break;
case ARMv7:
- search_strings[0] = "ARMv7" ;
- search_items = 1;
- ASSERT(search_items <= max_items);
+ search_string = "ARMv7";
break;
default:
UNREACHABLE();
}
- for (int i = 0; i < search_items; ++i) {
- if (CPUInfoContainsString(search_strings[i])) {
+ if (CPUInfoContainsString(search_string)) {
+ return true;
+ }
+
+ if (feature == VFP3) {
+ // Some old kernels will report vfp not vfpv3. Here we make a last attempt
+ // to detect vfpv3 by checking for vfp *and* neon, since neon is only
+ // available on architectures with vfpv3.
+ // Checking neon on its own is not enough as it is possible to have neon
+ // without vfp.
+ if (CPUInfoContainsString("vfp") && CPUInfoContainsString("neon")) {
return true;
}
}
diff --git a/src/version.cc b/src/version.cc
index d9be907f..7b552eee 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 2
#define MINOR_VERSION 5
#define BUILD_NUMBER 9
-#define PATCH_LEVEL 6
+#define PATCH_LEVEL 9
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the