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

Side by Side Diff: src/runtime.cc

Issue 10546166: ES5.2 var semantics: take hidden prototypes into account. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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 | 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 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 // <expr>" the initial value is the hole. 1302 // <expr>" the initial value is the hole.
1303 bool is_var = value->IsUndefined(); 1303 bool is_var = value->IsUndefined();
1304 bool is_const = value->IsTheHole(); 1304 bool is_const = value->IsTheHole();
1305 bool is_function = value->IsSharedFunctionInfo(); 1305 bool is_function = value->IsSharedFunctionInfo();
1306 bool is_module = value->IsJSModule(); 1306 bool is_module = value->IsJSModule();
1307 ASSERT(is_var + is_const + is_function + is_module == 1); 1307 ASSERT(is_var + is_const + is_function + is_module == 1);
1308 1308
1309 if (is_var || is_const) { 1309 if (is_var || is_const) {
1310 // Lookup the property in the global object, and don't set the 1310 // Lookup the property in the global object, and don't set the
1311 // value of the variable if the property is already there. 1311 // value of the variable if the property is already there.
1312 // Do the lookup locally only, see ES5 errata. 1312 // Do the lookup locally only, see ES5 erratum.
1313 LookupResult lookup(isolate); 1313 LookupResult lookup(isolate);
1314 if (FLAG_es52_globals) 1314 if (FLAG_es52_globals) {
1315 global->LocalLookup(*name, &lookup); 1315 Object* obj = *global;
1316 else 1316 do {
1317 JSObject::cast(obj)->LocalLookup(*name, &lookup);
1318 obj = obj->GetPrototype();
1319 } while (!lookup.IsFound() && obj->IsJSObject() &&
Michael Starzinger 2012/06/14 13:16:28 Can we move the "lookup.IsFound()" condition into
arv (Not doing code reviews) 2012/06/20 19:34:14 Also, there is no reason to get the prototype if l
1320 JSObject::cast(obj)->map()->is_hidden_prototype());
1321 } else {
1317 global->Lookup(*name, &lookup); 1322 global->Lookup(*name, &lookup);
1323 }
1318 if (lookup.IsProperty()) { 1324 if (lookup.IsProperty()) {
1319 // We found an existing property. Unless it was an interceptor 1325 // We found an existing property. Unless it was an interceptor
1320 // that claims the property is absent, skip this declaration. 1326 // that claims the property is absent, skip this declaration.
1321 if (lookup.type() != INTERCEPTOR) continue; 1327 if (lookup.type() != INTERCEPTOR) continue;
1322 PropertyAttributes attributes = global->GetPropertyAttribute(*name); 1328 PropertyAttributes attributes = global->GetPropertyAttribute(*name);
1323 if (attributes != ABSENT) continue; 1329 if (attributes != ABSENT) continue;
1324 // Fall-through and introduce the absent property by using 1330 // Fall-through and introduce the absent property by using
1325 // SetProperty. 1331 // SetProperty.
1326 } 1332 }
1327 } else if (is_function) { 1333 } else if (is_function) {
(...skipping 12236 matching lines...) Expand 10 before | Expand all | Expand 10 after
13564 // Handle last resort GC and make sure to allow future allocations 13570 // Handle last resort GC and make sure to allow future allocations
13565 // to grow the heap without causing GCs (if possible). 13571 // to grow the heap without causing GCs (if possible).
13566 isolate->counters()->gc_last_resort_from_js()->Increment(); 13572 isolate->counters()->gc_last_resort_from_js()->Increment();
13567 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13573 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13568 "Runtime::PerformGC"); 13574 "Runtime::PerformGC");
13569 } 13575 }
13570 } 13576 }
13571 13577
13572 13578
13573 } } // namespace v8::internal 13579 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698