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

Side by Side Diff: src/objects.cc

Issue 223613002: When freezing global object, go through the property cell (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | « no previous file | test/mjsunit/regress/regress-global-freeze-const.js » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 5489 matching lines...) Expand 10 before | Expand all | Expand 10 after
5500 5500
5501 template<typename Dictionary> 5501 template<typename Dictionary>
5502 static void FreezeDictionary(Dictionary* dictionary) { 5502 static void FreezeDictionary(Dictionary* dictionary) {
5503 int capacity = dictionary->Capacity(); 5503 int capacity = dictionary->Capacity();
5504 for (int i = 0; i < capacity; i++) { 5504 for (int i = 0; i < capacity; i++) {
5505 Object* k = dictionary->KeyAt(i); 5505 Object* k = dictionary->KeyAt(i);
5506 if (dictionary->IsKey(k)) { 5506 if (dictionary->IsKey(k)) {
5507 PropertyDetails details = dictionary->DetailsAt(i); 5507 PropertyDetails details = dictionary->DetailsAt(i);
5508 int attrs = DONT_DELETE; 5508 int attrs = DONT_DELETE;
5509 // READ_ONLY is an invalid attribute for JS setters/getters. 5509 // READ_ONLY is an invalid attribute for JS setters/getters.
5510 if (details.type() != CALLBACKS || 5510 if (details.type() == CALLBACKS) {
5511 !dictionary->ValueAt(i)->IsAccessorPair()) { 5511 Object* v = dictionary->ValueAt(i);
5512 if (v->IsPropertyCell()) v = PropertyCell::cast(v)->value();
5513 if (!v->IsAccessorPair()) attrs |= READ_ONLY;
5514 } else {
5512 attrs |= READ_ONLY; 5515 attrs |= READ_ONLY;
5513 } 5516 }
5514 details = details.CopyAddAttributes( 5517 details = details.CopyAddAttributes(
5515 static_cast<PropertyAttributes>(attrs)); 5518 static_cast<PropertyAttributes>(attrs));
5516 dictionary->DetailsAtPut(i, details); 5519 dictionary->DetailsAtPut(i, details);
5517 } 5520 }
5518 } 5521 }
5519 } 5522 }
5520 5523
5521 5524
(...skipping 10933 matching lines...) Expand 10 before | Expand all | Expand 10 after
16455 #define ERROR_MESSAGES_TEXTS(C, T) T, 16458 #define ERROR_MESSAGES_TEXTS(C, T) T,
16456 static const char* error_messages_[] = { 16459 static const char* error_messages_[] = {
16457 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16460 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16458 }; 16461 };
16459 #undef ERROR_MESSAGES_TEXTS 16462 #undef ERROR_MESSAGES_TEXTS
16460 return error_messages_[reason]; 16463 return error_messages_[reason];
16461 } 16464 }
16462 16465
16463 16466
16464 } } // namespace v8::internal 16467 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-global-freeze-const.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698