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

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 2718007: [Isolates] Moving TranscendentalCache to Isolate. (Closed)
Patch Set: Created 10 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
« no previous file with comments | « src/heap-inl.h ('k') | src/isolate.h » ('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 10277 matching lines...) Expand 10 before | Expand all | Expand 10 after
10288 // Compute hash: 10288 // Compute hash:
10289 // h = (low ^ high); h ^= h >> 16; h ^= h >> 8; h = h & (cacheSize - 1); 10289 // h = (low ^ high); h ^= h >> 16; h ^= h >> 8; h = h & (cacheSize - 1);
10290 __ mov(ecx, ebx); 10290 __ mov(ecx, ebx);
10291 __ xor_(ecx, Operand(edx)); 10291 __ xor_(ecx, Operand(edx));
10292 __ mov(eax, ecx); 10292 __ mov(eax, ecx);
10293 __ sar(eax, 16); 10293 __ sar(eax, 16);
10294 __ xor_(ecx, Operand(eax)); 10294 __ xor_(ecx, Operand(eax));
10295 __ mov(eax, ecx); 10295 __ mov(eax, ecx);
10296 __ sar(eax, 8); 10296 __ sar(eax, 8);
10297 __ xor_(ecx, Operand(eax)); 10297 __ xor_(ecx, Operand(eax));
10298 ASSERT(IsPowerOf2(TranscendentalCache::kCacheSize)); 10298 ASSERT(IsPowerOf2(TranscendentalCache::SubCache::kCacheSize));
10299 __ and_(Operand(ecx), Immediate(TranscendentalCache::kCacheSize - 1)); 10299 __ and_(Operand(ecx),
10300 Immediate(TranscendentalCache::SubCache::kCacheSize - 1));
10300 // ST[0] == double value. 10301 // ST[0] == double value.
10301 // ebx = low 32 bits of double value. 10302 // ebx = low 32 bits of double value.
10302 // edx = high 32 bits of double value. 10303 // edx = high 32 bits of double value.
10303 // ecx = TranscendentalCache::hash(double value). 10304 // ecx = TranscendentalCache::hash(double value).
10304 __ mov(eax, 10305 __ mov(eax,
10305 Immediate(ExternalReference::transcendental_cache_array_address())); 10306 Immediate(ExternalReference::transcendental_cache_array_address()));
10306 // Eax points to cache array. 10307 // Eax points to cache array.
10307 __ mov(eax, Operand(eax, type_ * sizeof(TranscendentalCache::caches_[0]))); 10308 __ mov(eax, Operand(eax, type_ * sizeof(
10309 Isolate::Current()->transcendental_cache()->caches_[0])));
10308 // Eax points to the cache for the type type_. 10310 // Eax points to the cache for the type type_.
10309 // If NULL, the cache hasn't been initialized yet, so go through runtime. 10311 // If NULL, the cache hasn't been initialized yet, so go through runtime.
10310 __ test(eax, Operand(eax)); 10312 __ test(eax, Operand(eax));
10311 __ j(zero, &runtime_call_clear_stack); 10313 __ j(zero, &runtime_call_clear_stack);
10312 #ifdef DEBUG 10314 #ifdef DEBUG
10313 // Check that the layout of cache elements match expectations. 10315 // Check that the layout of cache elements match expectations.
10314 { TranscendentalCache::Element test_elem[2]; 10316 { TranscendentalCache::SubCache::Element test_elem[2];
10315 char* elem_start = reinterpret_cast<char*>(&test_elem[0]); 10317 char* elem_start = reinterpret_cast<char*>(&test_elem[0]);
10316 char* elem2_start = reinterpret_cast<char*>(&test_elem[1]); 10318 char* elem2_start = reinterpret_cast<char*>(&test_elem[1]);
10317 char* elem_in0 = reinterpret_cast<char*>(&(test_elem[0].in[0])); 10319 char* elem_in0 = reinterpret_cast<char*>(&(test_elem[0].in[0]));
10318 char* elem_in1 = reinterpret_cast<char*>(&(test_elem[0].in[1])); 10320 char* elem_in1 = reinterpret_cast<char*>(&(test_elem[0].in[1]));
10319 char* elem_out = reinterpret_cast<char*>(&(test_elem[0].output)); 10321 char* elem_out = reinterpret_cast<char*>(&(test_elem[0].output));
10320 CHECK_EQ(12, elem2_start - elem_start); // Two uint_32's and a pointer. 10322 CHECK_EQ(12, elem2_start - elem_start); // Two uint_32's and a pointer.
10321 CHECK_EQ(0, elem_in0 - elem_start); 10323 CHECK_EQ(0, elem_in0 - elem_start);
10322 CHECK_EQ(kIntSize, elem_in1 - elem_start); 10324 CHECK_EQ(kIntSize, elem_in1 - elem_start);
10323 CHECK_EQ(2 * kIntSize, elem_out - elem_start); 10325 CHECK_EQ(2 * kIntSize, elem_out - elem_start);
10324 } 10326 }
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after
13700 masm.GetCode(&desc); 13702 masm.GetCode(&desc);
13701 // Call the function from C++. 13703 // Call the function from C++.
13702 return FUNCTION_CAST<MemCopyFunction>(buffer); 13704 return FUNCTION_CAST<MemCopyFunction>(buffer);
13703 } 13705 }
13704 13706
13705 #undef __ 13707 #undef __
13706 13708
13707 } } // namespace v8::internal 13709 } } // namespace v8::internal
13708 13710
13709 #endif // V8_TARGET_ARCH_IA32 13711 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698