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

Side by Side Diff: src/objects.cc

Issue 6723014: Avoid TLS access for counters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix lint 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 | « src/log.cc ('k') | src/parser.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 } 2348 }
2349 // Named property. 2349 // Named property.
2350 LookupResult result; 2350 LookupResult result;
2351 LocalLookup(name, &result); 2351 LocalLookup(name, &result);
2352 return GetPropertyAttribute(this, &result, name, false); 2352 return GetPropertyAttribute(this, &result, name, false);
2353 } 2353 }
2354 2354
2355 2355
2356 MaybeObject* NormalizedMapCache::Get(JSObject* obj, 2356 MaybeObject* NormalizedMapCache::Get(JSObject* obj,
2357 PropertyNormalizationMode mode) { 2357 PropertyNormalizationMode mode) {
2358 Isolate* isolate = obj->GetIsolate();
2358 Map* fast = obj->map(); 2359 Map* fast = obj->map();
2359 int index = Hash(fast) % kEntries; 2360 int index = Hash(fast) % kEntries;
2360 Object* result = get(index); 2361 Object* result = get(index);
2361 if (result->IsMap() && CheckHit(Map::cast(result), fast, mode)) { 2362 if (result->IsMap() && CheckHit(Map::cast(result), fast, mode)) {
2362 #ifdef DEBUG 2363 #ifdef DEBUG
2363 if (FLAG_enable_slow_asserts) { 2364 if (FLAG_enable_slow_asserts) {
2364 // The cached map should match newly created normalized map bit-by-bit. 2365 // The cached map should match newly created normalized map bit-by-bit.
2365 Object* fresh; 2366 Object* fresh;
2366 { MaybeObject* maybe_fresh = 2367 { MaybeObject* maybe_fresh =
2367 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); 2368 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP);
2368 if (maybe_fresh->ToObject(&fresh)) { 2369 if (maybe_fresh->ToObject(&fresh)) {
2369 ASSERT(memcmp(Map::cast(fresh)->address(), 2370 ASSERT(memcmp(Map::cast(fresh)->address(),
2370 Map::cast(result)->address(), 2371 Map::cast(result)->address(),
2371 Map::kSize) == 0); 2372 Map::kSize) == 0);
2372 } 2373 }
2373 } 2374 }
2374 } 2375 }
2375 #endif 2376 #endif
2376 return result; 2377 return result;
2377 } 2378 }
2378 2379
2379 { MaybeObject* maybe_result = 2380 { MaybeObject* maybe_result =
2380 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); 2381 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP);
2381 if (!maybe_result->ToObject(&result)) return maybe_result; 2382 if (!maybe_result->ToObject(&result)) return maybe_result;
2382 } 2383 }
2383 set(index, result); 2384 set(index, result);
2384 COUNTERS->normalized_maps()->Increment(); 2385 isolate->counters()->normalized_maps()->Increment();
2385 2386
2386 return result; 2387 return result;
2387 } 2388 }
2388 2389
2389 2390
2390 void NormalizedMapCache::Clear() { 2391 void NormalizedMapCache::Clear() {
2391 int entries = length(); 2392 int entries = length();
2392 for (int i = 0; i != entries; i++) { 2393 for (int i = 0; i != entries; i++) {
2393 set_undefined(i); 2394 set_undefined(i);
2394 } 2395 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 MaybeObject* JSObject::UpdateMapCodeCache(String* name, Code* code) { 2435 MaybeObject* JSObject::UpdateMapCodeCache(String* name, Code* code) {
2435 if (map()->is_shared()) { 2436 if (map()->is_shared()) {
2436 // Fast case maps are never marked as shared. 2437 // Fast case maps are never marked as shared.
2437 ASSERT(!HasFastProperties()); 2438 ASSERT(!HasFastProperties());
2438 // Replace the map with an identical copy that can be safely modified. 2439 // Replace the map with an identical copy that can be safely modified.
2439 Object* obj; 2440 Object* obj;
2440 { MaybeObject* maybe_obj = map()->CopyNormalized(KEEP_INOBJECT_PROPERTIES, 2441 { MaybeObject* maybe_obj = map()->CopyNormalized(KEEP_INOBJECT_PROPERTIES,
2441 UNIQUE_NORMALIZED_MAP); 2442 UNIQUE_NORMALIZED_MAP);
2442 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 2443 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2443 } 2444 }
2444 COUNTERS->normalized_maps()->Increment(); 2445 GetIsolate()->counters()->normalized_maps()->Increment();
2445 2446
2446 set_map(Map::cast(obj)); 2447 set_map(Map::cast(obj));
2447 } 2448 }
2448 return map()->UpdateCodeCache(name, code); 2449 return map()->UpdateCodeCache(name, code);
2449 } 2450 }
2450 2451
2451 2452
2452 MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode, 2453 MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode,
2453 int expected_additional_properties) { 2454 int expected_additional_properties) {
2454 if (!HasFastProperties()) return this; 2455 if (!HasFastProperties()) return this;
(...skipping 7790 matching lines...) Expand 10 before | Expand all | Expand 10 after
10245 if (break_point_objects()->IsUndefined()) return 0; 10246 if (break_point_objects()->IsUndefined()) return 0;
10246 // Single beak point. 10247 // Single beak point.
10247 if (!break_point_objects()->IsFixedArray()) return 1; 10248 if (!break_point_objects()->IsFixedArray()) return 1;
10248 // Multiple break points. 10249 // Multiple break points.
10249 return FixedArray::cast(break_point_objects())->length(); 10250 return FixedArray::cast(break_point_objects())->length();
10250 } 10251 }
10251 #endif 10252 #endif
10252 10253
10253 10254
10254 } } // namespace v8::internal 10255 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698