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

Side by Side Diff: src/objects.cc

Issue 9417044: Moved access checks out of Dictionary class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added whitespace. Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 9528 matching lines...) Expand 10 before | Expand all | Expand 10 after
9539 } 9539 }
9540 9540
9541 int entry = dictionary->FindEntry(index); 9541 int entry = dictionary->FindEntry(index);
9542 if (entry != SeededNumberDictionary::kNotFound) { 9542 if (entry != SeededNumberDictionary::kNotFound) {
9543 Object* element = dictionary->ValueAt(entry); 9543 Object* element = dictionary->ValueAt(entry);
9544 PropertyDetails details = dictionary->DetailsAt(entry); 9544 PropertyDetails details = dictionary->DetailsAt(entry);
9545 if (details.type() == CALLBACKS) { 9545 if (details.type() == CALLBACKS) {
9546 return SetElementWithCallback(element, index, value, this, strict_mode); 9546 return SetElementWithCallback(element, index, value, this, strict_mode);
9547 } else { 9547 } else {
9548 dictionary->UpdateMaxNumberKey(index); 9548 dictionary->UpdateMaxNumberKey(index);
9549 // If put fails in strict mode, throw an exception. 9549 // If a value has not been initialized we allow writing to it even if it
9550 if (!dictionary->ValueAtPut(entry, value) && strict_mode == kStrictMode) { 9550 // is read-only (a declared const that has not been initialized).
9551 if (!dictionary->DetailsAt(entry).IsReadOnly() ||
9552 dictionary->ValueAt(entry)->IsTheHole()) {
9553 dictionary->ValueAtPut(entry, value);
9554 } else if (strict_mode == kStrictMode) {
9551 Handle<Object> holder(this); 9555 Handle<Object> holder(this);
9552 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 9556 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
9553 Handle<Object> args[2] = { number, holder }; 9557 Handle<Object> args[2] = { number, holder };
9554 Handle<Object> error = 9558 Handle<Object> error =
9555 isolate->factory()->NewTypeError("strict_read_only_property", 9559 isolate->factory()->NewTypeError("strict_read_only_property",
9556 HandleVector(args, 2)); 9560 HandleVector(args, 2));
9557 return isolate->Throw(*error); 9561 return isolate->Throw(*error);
9558 } 9562 }
9559 } 9563 }
9560 } else { 9564 } else {
(...skipping 3510 matching lines...) Expand 10 before | Expand all | Expand 10 after
13071 if (break_point_objects()->IsUndefined()) return 0; 13075 if (break_point_objects()->IsUndefined()) return 0;
13072 // Single break point. 13076 // Single break point.
13073 if (!break_point_objects()->IsFixedArray()) return 1; 13077 if (!break_point_objects()->IsFixedArray()) return 1;
13074 // Multiple break points. 13078 // Multiple break points.
13075 return FixedArray::cast(break_point_objects())->length(); 13079 return FixedArray::cast(break_point_objects())->length();
13076 } 13080 }
13077 #endif // ENABLE_DEBUGGER_SUPPORT 13081 #endif // ENABLE_DEBUGGER_SUPPORT
13078 13082
13079 13083
13080 } } // namespace v8::internal 13084 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698