OLD | NEW |
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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 | 1280 |
1281 | 1281 |
1282 MaybeHandle<Object> StoreIC::Store(Handle<Object> object, | 1282 MaybeHandle<Object> StoreIC::Store(Handle<Object> object, |
1283 Handle<String> name, | 1283 Handle<String> name, |
1284 Handle<Object> value, | 1284 Handle<Object> value, |
1285 JSReceiver::StoreFromKeyed store_mode) { | 1285 JSReceiver::StoreFromKeyed store_mode) { |
1286 if (MigrateDeprecated(object) || object->IsJSProxy()) { | 1286 if (MigrateDeprecated(object) || object->IsJSProxy()) { |
1287 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); | 1287 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); |
1288 Handle<Object> result; | 1288 Handle<Object> result; |
1289 ASSIGN_RETURN_ON_EXCEPTION( | 1289 ASSIGN_RETURN_ON_EXCEPTION( |
1290 isolate(), | 1290 isolate(), result, |
1291 result, | 1291 JSReceiver::SetProperty(receiver, name, value, strict_mode()), Object); |
1292 JSReceiver::SetProperty(receiver, name, value, NONE, strict_mode()), | |
1293 Object); | |
1294 return result; | 1292 return result; |
1295 } | 1293 } |
1296 | 1294 |
1297 // If the object is undefined or null it's illegal to try to set any | 1295 // If the object is undefined or null it's illegal to try to set any |
1298 // properties on it; throw a TypeError in that case. | 1296 // properties on it; throw a TypeError in that case. |
1299 if (object->IsUndefined() || object->IsNull()) { | 1297 if (object->IsUndefined() || object->IsNull()) { |
1300 return TypeError("non_object_property_store", object, name); | 1298 return TypeError("non_object_property_store", object, name); |
1301 } | 1299 } |
1302 | 1300 |
1303 // The length property of string values is read-only. Throw in strict mode. | 1301 // The length property of string values is read-only. Throw in strict mode. |
(...skipping 17 matching lines...) Expand all Loading... |
1321 result, | 1319 result, |
1322 JSObject::SetElement(receiver, index, value, NONE, strict_mode()), | 1320 JSObject::SetElement(receiver, index, value, NONE, strict_mode()), |
1323 Object); | 1321 Object); |
1324 return value; | 1322 return value; |
1325 } | 1323 } |
1326 | 1324 |
1327 // Observed objects are always modified through the runtime. | 1325 // Observed objects are always modified through the runtime. |
1328 if (receiver->map()->is_observed()) { | 1326 if (receiver->map()->is_observed()) { |
1329 Handle<Object> result; | 1327 Handle<Object> result; |
1330 ASSIGN_RETURN_ON_EXCEPTION( | 1328 ASSIGN_RETURN_ON_EXCEPTION( |
1331 isolate(), | 1329 isolate(), result, JSReceiver::SetProperty(receiver, name, value, |
1332 result, | 1330 strict_mode(), store_mode), |
1333 JSReceiver::SetProperty( | |
1334 receiver, name, value, NONE, strict_mode(), store_mode), | |
1335 Object); | 1331 Object); |
1336 return result; | 1332 return result; |
1337 } | 1333 } |
1338 | 1334 |
1339 LookupResult lookup(isolate()); | 1335 LookupResult lookup(isolate()); |
1340 bool can_store = LookupForWrite(receiver, name, value, &lookup, this); | 1336 bool can_store = LookupForWrite(receiver, name, value, &lookup, this); |
1341 if (!can_store && | 1337 if (!can_store && |
1342 strict_mode() == STRICT && | 1338 strict_mode() == STRICT && |
1343 !(lookup.IsProperty() && lookup.IsReadOnly()) && | 1339 !(lookup.IsProperty() && lookup.IsReadOnly()) && |
1344 object->IsGlobalObject()) { | 1340 object->IsGlobalObject()) { |
(...skipping 10 matching lines...) Expand all Loading... |
1355 } else if (lookup.IsNormal() || | 1351 } else if (lookup.IsNormal() || |
1356 (lookup.IsField() && lookup.CanHoldValue(value))) { | 1352 (lookup.IsField() && lookup.CanHoldValue(value))) { |
1357 Handle<Code> stub = generic_stub(); | 1353 Handle<Code> stub = generic_stub(); |
1358 set_target(*stub); | 1354 set_target(*stub); |
1359 } | 1355 } |
1360 } | 1356 } |
1361 | 1357 |
1362 // Set the property. | 1358 // Set the property. |
1363 Handle<Object> result; | 1359 Handle<Object> result; |
1364 ASSIGN_RETURN_ON_EXCEPTION( | 1360 ASSIGN_RETURN_ON_EXCEPTION( |
1365 isolate(), | 1361 isolate(), result, |
1366 result, | 1362 JSReceiver::SetProperty(receiver, name, value, strict_mode(), store_mode), |
1367 JSReceiver::SetProperty( | |
1368 receiver, name, value, NONE, strict_mode(), store_mode), | |
1369 Object); | 1363 Object); |
1370 return result; | 1364 return result; |
1371 } | 1365 } |
1372 | 1366 |
1373 | 1367 |
1374 OStream& operator<<(OStream& os, const CallIC::State& s) { | 1368 OStream& operator<<(OStream& os, const CallIC::State& s) { |
1375 return os << "(args(" << s.arg_count() << "), " | 1369 return os << "(args(" << s.arg_count() << "), " |
1376 << (s.call_type() == CallIC::METHOD ? "METHOD" : "FUNCTION") | 1370 << (s.call_type() == CallIC::METHOD ? "METHOD" : "FUNCTION") |
1377 << ", "; | 1371 << ", "; |
1378 } | 1372 } |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3099 #undef ADDR | 3093 #undef ADDR |
3100 }; | 3094 }; |
3101 | 3095 |
3102 | 3096 |
3103 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3097 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3104 return IC_utilities[id]; | 3098 return IC_utilities[id]; |
3105 } | 3099 } |
3106 | 3100 |
3107 | 3101 |
3108 } } // namespace v8::internal | 3102 } } // namespace v8::internal |
OLD | NEW |