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

Unified Diff: src/objects.h

Issue 6613005: Implementation of strict mode in SetElement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: SetElement and strict mode. 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: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index de15a7398d7fd8c86242247e778a724153cef8a7..daace863e12f7c666b63398e86b611e2c9251c11 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1540,12 +1540,14 @@ class JSObject: public HeapObject {
MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index,
Object* value,
+ StrictModeFlag strict_mode,
bool check_prototype = true);
// Set the index'th array element.
// A Failure object is returned if GC is needed.
MUST_USE_RESULT MaybeObject* SetElement(uint32_t index,
Object* value,
+ StrictModeFlag strict_mode,
bool check_prototype = true);
// Returns the index'th element.
@@ -1805,12 +1807,15 @@ class JSObject: public HeapObject {
uint32_t index,
Object* value,
JSObject* holder);
- MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(uint32_t index,
- Object* value,
- bool check_prototype);
+ MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(
+ uint32_t index,
+ Object* value,
+ StrictModeFlag strict_mode,
+ bool check_prototype);
MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor(
uint32_t index,
Object* value,
+ StrictModeFlag strict_mode,
bool check_prototype);
MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index);
@@ -2447,13 +2452,18 @@ class Dictionary: public HashTable<Shape, Key> {
}
// Set the value for entry.
- void ValueAtPut(int entry, Object* value) {
+ // Returns false if the put wasn't performed due to property being read only.
+ // Returns true on successful put.
+ bool ValueAtPut(int entry, Object* value) {
// Check that this value can actually be written.
PropertyDetails details = DetailsAt(entry);
// If a value has not been initilized we allow writing to it even if
// it is read only (a declared const that has not been initialized).
- if (details.IsReadOnly() && !ValueAt(entry)->IsTheHole()) return;
- this->set(HashTable<Shape, Key>::EntryToIndex(entry)+1, value);
+ if (details.IsReadOnly() && !ValueAt(entry)->IsTheHole()) {
+ return false;
+ }
+ this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 1, value);
+ return true;
}
// Returns the property details for the property at entry.

Powered by Google App Engine
This is Rietveld 408576698