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

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

Issue 6576024: (early draft) Strict mode - throw exception on assignment to read only property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index a23ee171f2a556bdf5116639f8bc58ceb0bdccd2..426ed1f9ce9b3db915fb677b25f3cf5f5a9929de 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -214,11 +214,12 @@ TEST(GarbageCollection) {
function->set_initial_map(*initial_map);
Top::context()->global()->SetProperty(*name,
*function,
- NONE)->ToObjectChecked();
+ 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));
@@ -240,8 +241,8 @@ TEST(GarbageCollection) {
Handle<JSObject> obj = Factory::NewJSObject(function);
Top::context()->global()->SetProperty(*obj_name,
*obj,
- NONE)->ToObjectChecked();
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
+ 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();
+ NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
}
@@ -567,7 +568,7 @@ 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 +576,8 @@ 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 +589,8 @@ 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 +604,14 @@ 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 +632,7 @@ 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 +699,8 @@ 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 +717,8 @@ 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();

Powered by Google App Engine
This is Rietveld 408576698