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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 5720005: Add an untagged double to transcendental cache elements. They now contain an... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years 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
« src/ia32/code-stubs-ia32.cc ('K') | « src/ia32/code-stubs-ia32.cc ('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 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 __ j(zero, &runtime_call_clear_stack); 1062 __ j(zero, &runtime_call_clear_stack);
1063 #ifdef DEBUG 1063 #ifdef DEBUG
1064 // Check that the layout of cache elements match expectations. 1064 // Check that the layout of cache elements match expectations.
1065 { // NOLINT - doesn't like a single brace on a line. 1065 { // NOLINT - doesn't like a single brace on a line.
1066 TranscendentalCache::Element test_elem[2]; 1066 TranscendentalCache::Element test_elem[2];
1067 char* elem_start = reinterpret_cast<char*>(&test_elem[0]); 1067 char* elem_start = reinterpret_cast<char*>(&test_elem[0]);
1068 char* elem2_start = reinterpret_cast<char*>(&test_elem[1]); 1068 char* elem2_start = reinterpret_cast<char*>(&test_elem[1]);
1069 char* elem_in0 = reinterpret_cast<char*>(&(test_elem[0].in[0])); 1069 char* elem_in0 = reinterpret_cast<char*>(&(test_elem[0].in[0]));
1070 char* elem_in1 = reinterpret_cast<char*>(&(test_elem[0].in[1])); 1070 char* elem_in1 = reinterpret_cast<char*>(&(test_elem[0].in[1]));
1071 char* elem_out = reinterpret_cast<char*>(&(test_elem[0].output)); 1071 char* elem_out = reinterpret_cast<char*>(&(test_elem[0].output));
1072 char* elem_uout = reinterpret_cast<char*>(&(test_elem[0].untagged_output));
1072 // Two uint_32's and a pointer per element. 1073 // Two uint_32's and a pointer per element.
Erik Corry 2010/12/13 20:26:13 Wrong type name and out of date comment.
1073 CHECK_EQ(16, static_cast<int>(elem2_start - elem_start)); 1074 CHECK_EQ(24, static_cast<int>(elem2_start - elem_start));
1074 CHECK_EQ(0, static_cast<int>(elem_in0 - elem_start)); 1075 CHECK_EQ(0, static_cast<int>(elem_in0 - elem_start));
1075 CHECK_EQ(kIntSize, static_cast<int>(elem_in1 - elem_start)); 1076 CHECK_EQ(kIntSize, static_cast<int>(elem_in1 - elem_start));
1076 CHECK_EQ(2 * kIntSize, static_cast<int>(elem_out - elem_start)); 1077 CHECK_EQ(2 * kIntSize, static_cast<int>(elem_out - elem_start));
1078 CHECK_EQ(4 * kIntSize, static_cast<int>(elem_uout - elem_start));
1077 } 1079 }
1078 #endif 1080 #endif
1079 // Find the address of the rcx'th entry in the cache, i.e., &rax[rcx*16]. 1081 // Find the address of the rcx'th entry in the cache, i.e., &rax[rcx*16].
Erik Corry 2010/12/13 20:26:13 Out of date comment.
1080 __ addl(rcx, rcx); 1082 __ lea(rcx, Operand(rcx, rcx, times_2, 0));
1081 __ lea(rcx, Operand(rax, rcx, times_8, 0)); 1083 __ lea(rcx, Operand(rax, rcx, times_8, 0));
1082 // Check if cache matches: Double value is stored in uint32_t[2] array. 1084 // Check if cache matches: Double value is stored in uint32_t[2] array.
1083 NearLabel cache_miss; 1085 Label cache_miss;
Erik Corry 2010/12/13 20:26:13 Surely this is still within range of a NearLabel.
1086 NearLabel allocate_cached_answer;
1084 __ cmpq(rbx, Operand(rcx, 0)); 1087 __ cmpq(rbx, Operand(rcx, 0));
1085 __ j(not_equal, &cache_miss); 1088 __ j(not_equal, &cache_miss);
1086 // Cache hit! 1089 // Cache hit!
1087 __ movq(rax, Operand(rcx, 2 * kIntSize)); 1090 __ movq(rax, Operand(rcx, 2 * kIntSize));
1088 __ fstp(0); // Clear FPU stack. 1091 __ fstp(0); // Clear FPU stack.
1092 __ testq(rax, rax);
1093 __ j(zero, &allocate_cached_answer); // The answer is cached as untagged.
Erik Corry 2010/12/13 20:26:13 Comment could be clearer again.
1094 __ ret(kPointerSize);
1095
1096 __ bind(&allocate_cached_answer);
1097 __ AllocateHeapNumber(rax, rdi, &runtime_call_clear_stack);
1098 __ movq(rdi, Operand(rcx, 4 * kIntSize));
1099 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rdi);
1100 __ movq(Operand(rcx, 2 * kIntSize), rax);
1089 __ ret(kPointerSize); 1101 __ ret(kPointerSize);
1090 1102
1091 __ bind(&cache_miss); 1103 __ bind(&cache_miss);
1092 // Update cache with new value. 1104 // Update cache with new value.
1093 Label nan_result; 1105 Label nan_result;
1094 GenerateOperation(masm, &nan_result); 1106 GenerateOperation(masm, &nan_result);
1095 __ AllocateHeapNumber(rax, rdi, &runtime_call_clear_stack); 1107 __ AllocateHeapNumber(rax, rdi, &runtime_call_clear_stack);
1096 __ movq(Operand(rcx, 0), rbx); 1108 __ movq(Operand(rcx, 0), rbx);
1097 __ movq(Operand(rcx, 2 * kIntSize), rax); 1109 __ movq(Operand(rcx, 2 * kIntSize), rax);
1098 __ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset)); 1110 __ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset));
(...skipping 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 4113
4102 void ICCompareStub::GenerateMiss(MacroAssembler* masm) { 4114 void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
4103 UNIMPLEMENTED(); 4115 UNIMPLEMENTED();
4104 } 4116 }
4105 4117
4106 #undef __ 4118 #undef __
4107 4119
4108 } } // namespace v8::internal 4120 } } // namespace v8::internal
4109 4121
4110 #endif // V8_TARGET_ARCH_X64 4122 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/ia32/code-stubs-ia32.cc ('K') | « src/ia32/code-stubs-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698