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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/messages.js » ('j') | src/messages.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 573
574 void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee, 574 void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee,
575 Handle<Object> object) { 575 Handle<Object> object) {
576 while (callee->IsJSFunctionProxy()) { 576 while (callee->IsJSFunctionProxy()) {
577 callee = Handle<Object>(JSFunctionProxy::cast(*callee)->call_trap(), 577 callee = Handle<Object>(JSFunctionProxy::cast(*callee)->call_trap(),
578 isolate()); 578 isolate());
579 } 579 }
580 580
581 if (callee->IsJSFunction()) { 581 if (callee->IsJSFunction()) {
582 Handle<JSFunction> function = Handle<JSFunction>::cast(callee); 582 Handle<JSFunction> function = Handle<JSFunction>::cast(callee);
583 if (!function->shared()->is_classic_mode() || function->IsBuiltin()) { 583 if (!object->IsSymbol() &&
584 (!function->shared()->is_classic_mode() || function->IsBuiltin())) {
584 // Do not wrap receiver for strict mode functions or for builtins. 585 // Do not wrap receiver for strict mode functions or for builtins.
586 // Symbol receiver are always wrapped; Symbol builtins expect
587 // the wrapped form.
585 return; 588 return;
586 } 589 }
587 } 590 }
588 591
589 // And only wrap string, number or boolean. 592 // And only wrap string, number, boolean, or symbol.
590 if (object->IsString() || object->IsNumber() || object->IsBoolean()) { 593 if (object->IsString() ||
594 object->IsNumber() ||
595 object->IsBoolean() ||
596 object->IsSymbol()) {
591 // Change the receiver to the result of calling ToObject on it. 597 // Change the receiver to the result of calling ToObject on it.
592 const int argc = this->target()->arguments_count(); 598 const int argc = this->target()->arguments_count();
593 StackFrameLocator locator(isolate()); 599 StackFrameLocator locator(isolate());
594 JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); 600 JavaScriptFrame* frame = locator.FindJavaScriptFrame(0);
595 int index = frame->ComputeExpressionsCount() - (argc + 1); 601 int index = frame->ComputeExpressionsCount() - (argc + 1);
596 frame->SetExpression(index, *isolate()->factory()->ToObject(object)); 602 frame->SetExpression(index, *isolate()->factory()->ToObject(object));
597 } 603 }
598 } 604 }
599 605
600 606
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 Handle<ExecutableAccessorInfo>::cast(callback); 1264 Handle<ExecutableAccessorInfo>::cast(callback);
1259 if (v8::ToCData<Address>(info->getter()) == 0) break; 1265 if (v8::ToCData<Address>(info->getter()) == 0) break;
1260 if (!info->IsCompatibleReceiver(*object)) break; 1266 if (!info->IsCompatibleReceiver(*object)) break;
1261 return compiler.CompileLoadCallback(type, holder, name, info); 1267 return compiler.CompileLoadCallback(type, holder, name, info);
1262 } else if (callback->IsAccessorPair()) { 1268 } else if (callback->IsAccessorPair()) {
1263 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), 1269 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(),
1264 isolate()); 1270 isolate());
1265 if (!getter->IsJSFunction()) break; 1271 if (!getter->IsJSFunction()) break;
1266 if (holder->IsGlobalObject()) break; 1272 if (holder->IsGlobalObject()) break;
1267 if (!holder->HasFastProperties()) break; 1273 if (!holder->HasFastProperties()) break;
1274 // Symbol builtins expect the value to be boxed.
1275 if (object->IsSymbol()) break;
1268 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); 1276 Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
1269 if (!object->IsJSObject() && 1277 if (!object->IsJSObject() &&
1270 !function->IsBuiltin() && 1278 !function->IsBuiltin() &&
1271 function->shared()->is_classic_mode()) { 1279 function->shared()->is_classic_mode()) {
1272 // Calling non-strict non-builtins with a value as the receiver 1280 // Calling non-strict non-builtins with a value as the receiver
1273 // requires boxing. 1281 // requires boxing.
1274 break; 1282 break;
1275 } 1283 }
1276 CallOptimization call_optimization(function); 1284 CallOptimization call_optimization(function);
1277 if (call_optimization.is_simple_api_call() && 1285 if (call_optimization.is_simple_api_call() &&
(...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 #undef ADDR 3200 #undef ADDR
3193 }; 3201 };
3194 3202
3195 3203
3196 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3204 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3197 return IC_utilities[id]; 3205 return IC_utilities[id];
3198 } 3206 }
3199 3207
3200 3208
3201 } } // namespace v8::internal 3209 } } // namespace v8::internal
OLDNEW
« 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