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

Side by Side Diff: src/ic.cc

Issue 299403008: Fix storing to primitive objects by applying ToObject. This is necessary to ensure that we properly… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adding test Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/assign-primitive-property.js » ('j') | no next file with comments »
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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "api.h" 8 #include "api.h"
9 #include "arguments.h" 9 #include "arguments.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 return TypeError("non_object_property_store", object, name); 1268 return TypeError("non_object_property_store", object, name);
1269 } 1269 }
1270 1270
1271 // The length property of string values is read-only. Throw in strict mode. 1271 // The length property of string values is read-only. Throw in strict mode.
1272 if (strict_mode() == STRICT && object->IsString() && 1272 if (strict_mode() == STRICT && object->IsString() &&
1273 String::Equals(isolate()->factory()->length_string(), name)) { 1273 String::Equals(isolate()->factory()->length_string(), name)) {
1274 return TypeError("strict_read_only_property", object, name); 1274 return TypeError("strict_read_only_property", object, name);
1275 } 1275 }
1276 1276
1277 // Ignore other stores where the receiver is not a JSObject. 1277 // Ignore other stores where the receiver is not a JSObject.
1278 // TODO(1475): Must check prototype chains of object wrappers. 1278 if (!object->IsJSObject()) {
1279 if (!object->IsJSObject()) return value; 1279 // Proxies are already handled above.
1280 ASSERT(!object->IsJSReceiver());
1281 Handle<JSReceiver> receiver;
1282 Handle<Context> native_context(isolate()->context()->native_context());
1283 if (Object::ToObject(
1284 isolate(), object, native_context).ToHandle(&receiver)) {
1285 Handle<Object> result;
1286 ASSIGN_RETURN_ON_EXCEPTION(
1287 isolate(),
1288 result,
1289 JSReceiver::SetProperty(
1290 receiver, name, value, NONE, strict_mode(), store_mode),
1291 Object);
1292 }
1293 return value;
1294 }
1280 1295
1281 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1296 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1282 1297
1283 // Check if the given name is an array index. 1298 // Check if the given name is an array index.
1284 uint32_t index; 1299 uint32_t index;
1285 if (name->AsArrayIndex(&index)) { 1300 if (name->AsArrayIndex(&index)) {
1286 Handle<Object> result; 1301 Handle<Object> result;
1287 ASSIGN_RETURN_ON_EXCEPTION( 1302 ASSIGN_RETURN_ON_EXCEPTION(
1288 isolate(), 1303 isolate(),
1289 result, 1304 result,
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
3042 #undef ADDR 3057 #undef ADDR
3043 }; 3058 };
3044 3059
3045 3060
3046 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3061 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3047 return IC_utilities[id]; 3062 return IC_utilities[id];
3048 } 3063 }
3049 3064
3050 3065
3051 } } // namespace v8::internal 3066 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/assign-primitive-property.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698