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

Unified Diff: test/cctest/test-heap.cc

Issue 6594037: Strict Mode assignment to read only property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR Feedback. Created 9 years, 10 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 | « test/cctest/test-debug.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index a23ee171f2a556bdf5116639f8bc58ceb0bdccd2..9cce01eaea91cbe02a3dce955e9397b6d8e19355 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -212,13 +212,14 @@ TEST(GarbageCollection) {
Handle<Map> initial_map =
Factory::NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
function->set_initial_map(*initial_map);
- Top::context()->global()->SetProperty(*name,
- *function,
- NONE)->ToObjectChecked();
+ Top::context()->global()->SetProperty(
+ *name, *function, NONE, kNonStrictMode)->ToObjectChecked();
// Allocate an object. Unrooted after leaving the scope.
Handle<JSObject> obj = Factory::NewJSObject(function);
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
- obj->SetProperty(*prop_namex, Smi::FromInt(24), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_namex, Smi::FromInt(24), NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
CHECK_EQ(Smi::FromInt(24), obj->GetProperty(*prop_namex));
@@ -238,10 +239,10 @@ TEST(GarbageCollection) {
HandleScope inner_scope;
// Allocate another object, make it reachable from global.
Handle<JSObject> obj = Factory::NewJSObject(function);
- Top::context()->global()->SetProperty(*obj_name,
- *obj,
- NONE)->ToObjectChecked();
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
+ Top::context()->global()->SetProperty(
+ *obj_name, *obj, NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
}
// After gc, it should survive.
@@ -540,12 +541,12 @@ TEST(FunctionAllocation) {
Handle<String> prop_name = Factory::LookupAsciiSymbol("theSlot");
Handle<JSObject> obj = Factory::NewJSObject(function);
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
// Check that we can add properties to function objects.
- function->SetProperty(*prop_name,
- Smi::FromInt(24),
- NONE)->ToObjectChecked();
+ function->SetProperty(
+ *prop_name, Smi::FromInt(24), NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
}
@@ -567,7 +568,8 @@ TEST(ObjectProperties) {
CHECK(!obj->HasLocalProperty(*first));
// add first
- obj->SetProperty(*first, Smi::FromInt(1), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
CHECK(obj->HasLocalProperty(*first));
// delete first
@@ -575,8 +577,10 @@ TEST(ObjectProperties) {
CHECK(!obj->HasLocalProperty(*first));
// add first and then second
- obj->SetProperty(*first, Smi::FromInt(1), NONE)->ToObjectChecked();
- obj->SetProperty(*second, Smi::FromInt(2), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
CHECK(obj->HasLocalProperty(*first));
CHECK(obj->HasLocalProperty(*second));
@@ -588,8 +592,10 @@ TEST(ObjectProperties) {
CHECK(!obj->HasLocalProperty(*second));
// add first and then second
- obj->SetProperty(*first, Smi::FromInt(1), NONE)->ToObjectChecked();
- obj->SetProperty(*second, Smi::FromInt(2), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
CHECK(obj->HasLocalProperty(*first));
CHECK(obj->HasLocalProperty(*second));
@@ -603,14 +609,16 @@ TEST(ObjectProperties) {
// check string and symbol match
static const char* string1 = "fisk";
Handle<String> s1 = Factory::NewStringFromAscii(CStrVector(string1));
- obj->SetProperty(*s1, Smi::FromInt(1), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *s1, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
Handle<String> s1_symbol = Factory::LookupAsciiSymbol(string1);
CHECK(obj->HasLocalProperty(*s1_symbol));
// check symbol and string match
static const char* string2 = "fugl";
Handle<String> s2_symbol = Factory::LookupAsciiSymbol(string2);
- obj->SetProperty(*s2_symbol, Smi::FromInt(1), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *s2_symbol, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
Handle<String> s2 = Factory::NewStringFromAscii(CStrVector(string2));
CHECK(obj->HasLocalProperty(*s2));
}
@@ -631,7 +639,8 @@ TEST(JSObjectMaps) {
Handle<JSObject> obj = Factory::NewJSObject(function);
// Set a propery
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
// Check the map has changed
@@ -698,8 +707,10 @@ TEST(JSObjectCopy) {
Handle<String> first = Factory::LookupAsciiSymbol("first");
Handle<String> second = Factory::LookupAsciiSymbol("second");
- obj->SetProperty(*first, Smi::FromInt(1), NONE)->ToObjectChecked();
- obj->SetProperty(*second, Smi::FromInt(2), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
Object* ok = obj->SetElement(0, *first)->ToObjectChecked();
@@ -716,8 +727,10 @@ TEST(JSObjectCopy) {
CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
// Flip the values.
- clone->SetProperty(*first, Smi::FromInt(2), NONE)->ToObjectChecked();
- clone->SetProperty(*second, Smi::FromInt(1), NONE)->ToObjectChecked();
+ clone->SetProperty(
+ *first, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
+ clone->SetProperty(
+ *second, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
ok = clone->SetElement(0, *second)->ToObjectChecked();
ok = clone->SetElement(1, *first)->ToObjectChecked();
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698