Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Unified Diff: src/api.cc

Issue 20703002: Revert "Check that ExternalString objects get aligned resources" (r15894). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 91174d69e9c2605af189d2986605022765cffe4f..5978ed270e34d51d8a5de093310ba023d0810a55 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -779,8 +779,8 @@ static void* DecodeSmiToAligned(i::Object* value, const char* location) {
}
-static i::Smi* EncodeAlignedAsSmi(const void* value, const char* location) {
- i::Smi* smi = const_cast<i::Smi*>(reinterpret_cast<const i::Smi*>(value));
+static i::Smi* EncodeAlignedAsSmi(void* value, const char* location) {
+ i::Smi* smi = reinterpret_cast<i::Smi*>(value);
ApiCheck(smi->IsSmi(), location, "Pointer is not aligned");
return smi;
}
@@ -5937,10 +5937,6 @@ Local<String> v8::String::NewExternal(
LOG_API(isolate, "String::NewExternal");
ENTER_V8(isolate);
CHECK(resource && resource->data());
- // Resource pointers need to look like Smis since ExternalString objects
- // are sometimes put into old pointer space (see i::String::MakeExternal).
- CHECK(EncodeAlignedAsSmi(resource, "v8::String::NewExternal()"));
- CHECK(EncodeAlignedAsSmi(resource->data(), "v8::String::NewExternal()"));
i::Handle<i::String> result = NewExternalStringHandle(isolate, resource);
isolate->heap()->external_string_table()->AddString(*result);
return Utils::ToLocal(result);
@@ -5962,10 +5958,6 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
return false;
}
CHECK(resource && resource->data());
- // Resource pointers need to look like Smis since ExternalString objects
- // are sometimes put into old pointer space (see i::String::MakeExternal).
- CHECK(EncodeAlignedAsSmi(resource, "v8::String::MakeExternal()"));
- CHECK(EncodeAlignedAsSmi(resource->data(), "v8::String::MakeExternal()"));
bool result = obj->MakeExternal(resource);
if (result && !obj->IsInternalizedString()) {
isolate->heap()->external_string_table()->AddString(*obj);
@@ -5981,10 +5973,6 @@ Local<String> v8::String::NewExternal(
LOG_API(isolate, "String::NewExternal");
ENTER_V8(isolate);
CHECK(resource && resource->data());
- // Resource pointers need to look like Smis since ExternalString objects
- // are sometimes put into old pointer space (see i::String::MakeExternal).
- CHECK(EncodeAlignedAsSmi(resource, "v8::String::NewExternal()"));
- CHECK(EncodeAlignedAsSmi(resource->data(), "v8::String::NewExternal()"));
i::Handle<i::String> result = NewExternalAsciiStringHandle(isolate, resource);
isolate->heap()->external_string_table()->AddString(*result);
return Utils::ToLocal(result);
@@ -6007,10 +5995,6 @@ bool v8::String::MakeExternal(
return false;
}
CHECK(resource && resource->data());
- // Resource pointers need to look like Smis since ExternalString objects
- // are sometimes put into old pointer space (see i::String::MakeExternal).
- CHECK(EncodeAlignedAsSmi(resource, "v8::String::MakeExternal()"));
- CHECK(EncodeAlignedAsSmi(resource->data(), "v8::String::MakeExternal()"));
bool result = obj->MakeExternal(resource);
if (result && !obj->IsInternalizedString()) {
isolate->heap()->external_string_table()->AddString(*obj);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698