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

Unified Diff: src/ic.cc

Issue 118553003: Upgrade Symbol implementation to match current ES6 behavior. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Fix fundamental issues surrounding Symbol values vs (wrapper) objects Created 6 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 | src/messages.js » ('j') | src/messages.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index a642230a2885e99653f5190e9f0f555943abe121..e3021e1b0f99188858857d23cb10503e3c89ed14 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -580,14 +580,20 @@ void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee,
if (callee->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(callee);
- if (!function->shared()->is_classic_mode() || function->IsBuiltin()) {
+ if (!object->IsSymbol() &&
+ (!function->shared()->is_classic_mode() || function->IsBuiltin())) {
// Do not wrap receiver for strict mode functions or for builtins.
+ // Symbol receiver are always wrapped; Symbol builtins expect
+ // the wrapped form.
return;
}
}
- // And only wrap string, number or boolean.
- if (object->IsString() || object->IsNumber() || object->IsBoolean()) {
+ // And only wrap string, number, boolean, or symbol.
+ if (object->IsString() ||
+ object->IsNumber() ||
+ object->IsBoolean() ||
+ object->IsSymbol()) {
// Change the receiver to the result of calling ToObject on it.
const int argc = this->target()->arguments_count();
StackFrameLocator locator(isolate());
@@ -1265,6 +1271,8 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
if (!getter->IsJSFunction()) break;
if (holder->IsGlobalObject()) break;
if (!holder->HasFastProperties()) break;
+ // Symbol builtins expect the value to be boxed.
+ if (object->IsSymbol()) break;
Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
if (!object->IsJSObject() &&
!function->IsBuiltin() &&
« no previous file with comments | « no previous file | src/messages.js » ('j') | src/messages.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698