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

Side by Side Diff: src/arm/regexp-macro-assembler-arm.cc

Issue 23515007: ARM: remove the regexp specific literal pool. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/arm/regexp-macro-assembler-arm.h ('k') | src/assembler.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 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 mode_(mode), 127 mode_(mode),
128 num_registers_(registers_to_save), 128 num_registers_(registers_to_save),
129 num_saved_registers_(registers_to_save), 129 num_saved_registers_(registers_to_save),
130 entry_label_(), 130 entry_label_(),
131 start_label_(), 131 start_label_(),
132 success_label_(), 132 success_label_(),
133 backtrack_label_(), 133 backtrack_label_(),
134 exit_label_() { 134 exit_label_() {
135 ASSERT_EQ(0, registers_to_save % 2); 135 ASSERT_EQ(0, registers_to_save % 2);
136 __ jmp(&entry_label_); // We'll write the entry code later. 136 __ jmp(&entry_label_); // We'll write the entry code later.
137 EmitBacktrackConstantPool();
138 __ bind(&start_label_); // And then continue from here. 137 __ bind(&start_label_); // And then continue from here.
139 } 138 }
140 139
141 140
142 RegExpMacroAssemblerARM::~RegExpMacroAssemblerARM() { 141 RegExpMacroAssemblerARM::~RegExpMacroAssemblerARM() {
143 delete masm_; 142 delete masm_;
144 // Unuse labels in case we throw away the assembler without calling GetCode. 143 // Unuse labels in case we throw away the assembler without calling GetCode.
145 entry_label_.Unuse(); 144 entry_label_.Unuse();
146 start_label_.Unuse(); 145 start_label_.Unuse();
147 success_label_.Unuse(); 146 success_label_.Unuse();
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 Pop(current_input_offset()); 930 Pop(current_input_offset());
932 } 931 }
933 932
934 933
935 void RegExpMacroAssemblerARM::PopRegister(int register_index) { 934 void RegExpMacroAssemblerARM::PopRegister(int register_index) {
936 Pop(r0); 935 Pop(r0);
937 __ str(r0, register_location(register_index)); 936 __ str(r0, register_location(register_index));
938 } 937 }
939 938
940 939
941 static bool is_valid_memory_offset(int value) {
942 if (value < 0) value = -value;
943 return value < (1<<12);
944 }
945
946
947 void RegExpMacroAssemblerARM::PushBacktrack(Label* label) { 940 void RegExpMacroAssemblerARM::PushBacktrack(Label* label) {
948 if (label->is_bound()) { 941 __ mov_label_offset(r0, label);
949 int target = label->pos();
950 __ mov(r0, Operand(target + Code::kHeaderSize - kHeapObjectTag));
951 } else {
952 int constant_offset = GetBacktrackConstantPoolEntry();
953 masm_->label_at_put(label, constant_offset);
954 // Reading pc-relative is based on the address 8 bytes ahead of
955 // the current opcode.
956 unsigned int offset_of_pc_register_read =
957 masm_->pc_offset() + Assembler::kPcLoadDelta;
958 int pc_offset_of_constant =
959 constant_offset - offset_of_pc_register_read;
960 ASSERT(pc_offset_of_constant < 0);
961 if (is_valid_memory_offset(pc_offset_of_constant)) {
962 Assembler::BlockConstPoolScope block_const_pool(masm_);
963 __ ldr(r0, MemOperand(pc, pc_offset_of_constant));
964 } else {
965 // Not a 12-bit offset, so it needs to be loaded from the constant
966 // pool.
967 Assembler::BlockConstPoolScope block_const_pool(masm_);
968 __ mov(r0, Operand(pc_offset_of_constant + Assembler::kInstrSize));
969 __ ldr(r0, MemOperand(pc, r0));
970 }
971 }
972 Push(r0); 942 Push(r0);
973 CheckStackLimit(); 943 CheckStackLimit();
974 } 944 }
975 945
976 946
977 void RegExpMacroAssemblerARM::PushCurrentPosition() { 947 void RegExpMacroAssemblerARM::PushCurrentPosition() {
978 Push(current_input_offset()); 948 Push(current_input_offset());
979 } 949 }
980 950
981 951
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 void RegExpMacroAssemblerARM::CheckStackLimit() { 1243 void RegExpMacroAssemblerARM::CheckStackLimit() {
1274 ExternalReference stack_limit = 1244 ExternalReference stack_limit =
1275 ExternalReference::address_of_regexp_stack_limit(isolate()); 1245 ExternalReference::address_of_regexp_stack_limit(isolate());
1276 __ mov(r0, Operand(stack_limit)); 1246 __ mov(r0, Operand(stack_limit));
1277 __ ldr(r0, MemOperand(r0)); 1247 __ ldr(r0, MemOperand(r0));
1278 __ cmp(backtrack_stackpointer(), Operand(r0)); 1248 __ cmp(backtrack_stackpointer(), Operand(r0));
1279 SafeCall(&stack_overflow_label_, ls); 1249 SafeCall(&stack_overflow_label_, ls);
1280 } 1250 }
1281 1251
1282 1252
1283 void RegExpMacroAssemblerARM::EmitBacktrackConstantPool() {
1284 __ CheckConstPool(false, false);
1285 Assembler::BlockConstPoolScope block_const_pool(masm_);
1286 backtrack_constant_pool_offset_ = masm_->pc_offset();
1287 for (int i = 0; i < kBacktrackConstantPoolSize; i++) {
1288 __ emit(0);
1289 }
1290
1291 backtrack_constant_pool_capacity_ = kBacktrackConstantPoolSize;
1292 }
1293
1294
1295 int RegExpMacroAssemblerARM::GetBacktrackConstantPoolEntry() {
1296 while (backtrack_constant_pool_capacity_ > 0) {
1297 int offset = backtrack_constant_pool_offset_;
1298 backtrack_constant_pool_offset_ += kPointerSize;
1299 backtrack_constant_pool_capacity_--;
1300 if (masm_->pc_offset() - offset < 2 * KB) {
1301 return offset;
1302 }
1303 }
1304 Label new_pool_skip;
1305 __ jmp(&new_pool_skip);
1306 EmitBacktrackConstantPool();
1307 __ bind(&new_pool_skip);
1308 int offset = backtrack_constant_pool_offset_;
1309 backtrack_constant_pool_offset_ += kPointerSize;
1310 backtrack_constant_pool_capacity_--;
1311 return offset;
1312 }
1313
1314
1315 bool RegExpMacroAssemblerARM::CanReadUnaligned() { 1253 bool RegExpMacroAssemblerARM::CanReadUnaligned() {
1316 return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe(); 1254 return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe();
1317 } 1255 }
1318 1256
1319 1257
1320 void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset, 1258 void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset,
1321 int characters) { 1259 int characters) {
1322 Register offset = current_input_offset(); 1260 Register offset = current_input_offset();
1323 if (cp_offset != 0) { 1261 if (cp_offset != 0) {
1324 // r4 is not being used to store the capture start index at this point. 1262 // r4 is not being used to store the capture start index at this point.
(...skipping 29 matching lines...) Expand all
1354 } 1292 }
1355 1293
1356 1294
1357 #undef __ 1295 #undef __
1358 1296
1359 #endif // V8_INTERPRETED_REGEXP 1297 #endif // V8_INTERPRETED_REGEXP
1360 1298
1361 }} // namespace v8::internal 1299 }} // namespace v8::internal
1362 1300
1363 #endif // V8_TARGET_ARCH_ARM 1301 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.h ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698