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

Unified Diff: src/objects.cc

Issue 12957004: ES6 symbols: turn symbols into a proper primitive type (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 9 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 | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 00d00d5ee6f01c6f63160af1a79ece38f05968a9..d4c0a5a0c7d81c1ca4dde8270c2de1d282162cd6 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -126,10 +126,10 @@ void Object::Lookup(Name* name, LookupResult* result) {
holder = native_context->number_function()->instance_prototype();
} else if (IsString()) {
holder = native_context->string_function()->instance_prototype();
+ } else if (IsSymbol()) {
+ holder = native_context->symbol_function()->instance_prototype();
} else if (IsBoolean()) {
holder = native_context->boolean_function()->instance_prototype();
- } else if (IsSymbol()) {
- holder = native_context->symbol_delegate();
} else {
Isolate::Current()->PushStackTraceAndDie(
0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001);
@@ -756,7 +756,7 @@ MaybeObject* Object::GetProperty(Object* receiver,
// holder in the prototype chain.
// Proxy handlers do not use the proxy's prototype, so we can skip this.
if (!result->IsHandler()) {
- Object* last = result->IsProperty() && !receiver->IsSymbol()
+ Object* last = result->IsProperty()
? result->holder()
: Object::cast(heap->null_value());
ASSERT(this != this->GetPrototype(isolate));
@@ -837,10 +837,10 @@ MaybeObject* Object::GetElementWithReceiver(Object* receiver, uint32_t index) {
holder = native_context->number_function()->instance_prototype();
} else if (holder->IsString()) {
holder = native_context->string_function()->instance_prototype();
+ } else if (holder->IsSymbol()) {
+ holder = native_context->symbol_function()->instance_prototype();
} else if (holder->IsBoolean()) {
holder = native_context->boolean_function()->instance_prototype();
- } else if (holder->IsSymbol()) {
- holder = native_context->symbol_delegate();
} else if (holder->IsJSProxy()) {
return JSProxy::cast(holder)->GetElementWithHandler(receiver, index);
} else {
@@ -900,6 +900,9 @@ Object* Object::GetPrototype(Isolate* isolate) {
if (heap_object->IsString()) {
return context->string_function()->instance_prototype();
}
+ if (heap_object->IsSymbol()) {
+ return context->symbol_function()->instance_prototype();
+ }
if (heap_object->IsBoolean()) {
return context->boolean_function()->instance_prototype();
} else {
@@ -908,16 +911,6 @@ Object* Object::GetPrototype(Isolate* isolate) {
}
-Object* Object::GetDelegate(Isolate* isolate) {
- if (IsSymbol()) {
- Heap* heap = Symbol::cast(this)->GetHeap();
- Context* context = heap->isolate()->context()->native_context();
- return context->symbol_delegate();
- }
- return GetPrototype(isolate);
-}
-
-
MaybeObject* Object::GetHash(CreationFlag flag) {
// The object is either a number, a name, an odd-ball,
// a real JS object, or a Harmony proxy.
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698