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

Unified Diff: src/api.cc

Issue 892393003: Update harmony ObjectProtoToString() to 2/2/2015 spec (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add tests for non-string @@toStringTag in test-api.cc Created 5 years, 11 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 | test/cctest/cctest.h » ('j') | 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 6caa82a5ea5d907119da06e0f2b35e7ce7794347..d5168cd3853e2e6129103471f72231512292c1d0 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3290,37 +3290,6 @@ Local<Array> v8::Object::GetOwnPropertyNames() {
}
-static bool GetPredefinedToString(i::Handle<i::String> tag,
- Local<String>* result) {
- i::Isolate* i_isolate = tag->GetIsolate();
- Isolate* isolate = reinterpret_cast<Isolate*>(i_isolate);
- i::Factory* factory = i_isolate->factory();
-
- if (i::String::Equals(tag, factory->Arguments_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~Arguments]");
- } else if (i::String::Equals(tag, factory->Array_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~Array]");
- } else if (i::String::Equals(tag, factory->Boolean_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~Boolean]");
- } else if (i::String::Equals(tag, factory->Date_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~Date]");
- } else if (i::String::Equals(tag, factory->Error_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~Error]");
- } else if (i::String::Equals(tag, factory->Function_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~Function]");
- } else if (i::String::Equals(tag, factory->Number_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~Number]");
- } else if (i::String::Equals(tag, factory->RegExp_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~RegExp]");
- } else if (i::String::Equals(tag, factory->String_string())) {
- *result = v8::String::NewFromUtf8(isolate, "[object ~String]");
- } else {
- return false;
- }
- return true;
-}
-
-
Local<String> v8::Object::ObjectProtoToString() {
i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
Isolate* isolate = reinterpret_cast<Isolate*>(i_isolate);
@@ -3354,16 +3323,8 @@ Local<String> v8::Object::ObjectProtoToString() {
.ToHandle(&tag);
EXCEPTION_BAILOUT_CHECK(i_isolate, Local<v8::String>());
- if (!tag->IsUndefined()) {
- if (!tag->IsString())
- return v8::String::NewFromUtf8(isolate, "[object ???]");
- i::Handle<i::String> tag_name = i::Handle<i::String>::cast(tag);
- if (!i::String::Equals(class_name, tag_name)) {
- Local<String> result;
- if (GetPredefinedToString(tag_name, &result)) return result;
-
- class_name = tag_name;
- }
+ if (tag->IsString()) {
+ class_name = i::Handle<i::String>::cast(tag);
}
}
const char* prefix = "[object ";
« no previous file with comments | « no previous file | test/cctest/cctest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698