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

Side by Side Diff: test/cctest/test-mark-compact.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: Assign to read only property in strict mode. Created 9 years, 9 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 | « test/cctest/test-heap.cc ('k') | test/es5conform/es5conform.status » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 JSFunction* function = JSFunction::cast( 182 JSFunction* function = JSFunction::cast(
183 Heap::AllocateFunction(*Top::function_map(), 183 Heap::AllocateFunction(*Top::function_map(),
184 function_share, 184 function_share,
185 Heap::undefined_value())->ToObjectChecked()); 185 Heap::undefined_value())->ToObjectChecked());
186 Map* initial_map = 186 Map* initial_map =
187 Map::cast(Heap::AllocateMap(JS_OBJECT_TYPE, 187 Map::cast(Heap::AllocateMap(JS_OBJECT_TYPE,
188 JSObject::kHeaderSize)->ToObjectChecked()); 188 JSObject::kHeaderSize)->ToObjectChecked());
189 function->set_initial_map(initial_map); 189 function->set_initial_map(initial_map);
190 Top::context()->global()->SetProperty(func_name, 190 Top::context()->global()->SetProperty(func_name,
191 function, 191 function,
192 NONE)->ToObjectChecked(); 192 NONE,
193 kNonStrictMode)->ToObjectChecked();
193 194
194 JSObject* obj = 195 JSObject* obj =
195 JSObject::cast(Heap::AllocateJSObject(function)->ToObjectChecked()); 196 JSObject::cast(Heap::AllocateJSObject(function)->ToObjectChecked());
196 Heap::CollectGarbage(OLD_POINTER_SPACE); 197 Heap::CollectGarbage(OLD_POINTER_SPACE);
197 198
198 func_name = 199 func_name =
199 String::cast(Heap::LookupAsciiSymbol("theFunction")->ToObjectChecked()); 200 String::cast(Heap::LookupAsciiSymbol("theFunction")->ToObjectChecked());
200 CHECK(Top::context()->global()->HasLocalProperty(func_name)); 201 CHECK(Top::context()->global()->HasLocalProperty(func_name));
201 Object* func_value = 202 Object* func_value =
202 Top::context()->global()->GetProperty(func_name)->ToObjectChecked(); 203 Top::context()->global()->GetProperty(func_name)->ToObjectChecked();
203 CHECK(func_value->IsJSFunction()); 204 CHECK(func_value->IsJSFunction());
204 function = JSFunction::cast(func_value); 205 function = JSFunction::cast(func_value);
205 206
206 obj = JSObject::cast(Heap::AllocateJSObject(function)->ToObjectChecked()); 207 obj = JSObject::cast(Heap::AllocateJSObject(function)->ToObjectChecked());
207 String* obj_name = 208 String* obj_name =
208 String::cast(Heap::LookupAsciiSymbol("theObject")->ToObjectChecked()); 209 String::cast(Heap::LookupAsciiSymbol("theObject")->ToObjectChecked());
209 Top::context()->global()->SetProperty(obj_name, 210 Top::context()->global()->SetProperty(obj_name,
210 obj, 211 obj,
211 NONE)->ToObjectChecked(); 212 NONE,
213 kNonStrictMode)->ToObjectChecked();
212 String* prop_name = 214 String* prop_name =
213 String::cast(Heap::LookupAsciiSymbol("theSlot")->ToObjectChecked()); 215 String::cast(Heap::LookupAsciiSymbol("theSlot")->ToObjectChecked());
214 obj->SetProperty(prop_name, Smi::FromInt(23), NONE)->ToObjectChecked(); 216 obj->SetProperty(prop_name,
217 Smi::FromInt(23),
218 NONE,
219 kNonStrictMode)->ToObjectChecked();
215 220
216 Heap::CollectGarbage(OLD_POINTER_SPACE); 221 Heap::CollectGarbage(OLD_POINTER_SPACE);
217 222
218 obj_name = 223 obj_name =
219 String::cast(Heap::LookupAsciiSymbol("theObject")->ToObjectChecked()); 224 String::cast(Heap::LookupAsciiSymbol("theObject")->ToObjectChecked());
220 CHECK(Top::context()->global()->HasLocalProperty(obj_name)); 225 CHECK(Top::context()->global()->HasLocalProperty(obj_name));
221 CHECK(Top::context()->global()-> 226 CHECK(Top::context()->global()->
222 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); 227 GetProperty(obj_name)->ToObjectChecked()->IsJSObject());
223 obj = JSObject::cast( 228 obj = JSObject::cast(
224 Top::context()->global()->GetProperty(obj_name)->ToObjectChecked()); 229 Top::context()->global()->GetProperty(obj_name)->ToObjectChecked());
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; 359 Object** g2_objects[] = { g2s1.location(), g2s2.location() };
355 GlobalHandles::AddGroup(g1_objects, 2); 360 GlobalHandles::AddGroup(g1_objects, 2);
356 GlobalHandles::AddGroup(g2_objects, 2); 361 GlobalHandles::AddGroup(g2_objects, 2);
357 } 362 }
358 363
359 Heap::CollectGarbage(OLD_POINTER_SPACE); 364 Heap::CollectGarbage(OLD_POINTER_SPACE);
360 365
361 // All objects should be gone. 5 global handles in total. 366 // All objects should be gone. 5 global handles in total.
362 CHECK_EQ(5, NumberOfWeakCalls); 367 CHECK_EQ(5, NumberOfWeakCalls);
363 } 368 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/es5conform/es5conform.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698