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/mips/regexp-macro-assembler-mips.cc

Issue 24233003: MIPS: replace RegExpCEntryStub with DirectCEntryStub. (Closed) Base URL: https://github.com/v8/v8.git@gbl
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
« no previous file with comments | « src/mips/regexp-macro-assembler-mips.h ('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 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1056
1057 1057
1058 bool RegExpMacroAssemblerMIPS::CanReadUnaligned() { 1058 bool RegExpMacroAssemblerMIPS::CanReadUnaligned() {
1059 return false; 1059 return false;
1060 } 1060 }
1061 1061
1062 1062
1063 // Private methods: 1063 // Private methods:
1064 1064
1065 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) { 1065 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) {
1066 static const int num_arguments = 3; 1066 __ PrepareCallCFunction(3, scratch);
1067 __ PrepareCallCFunction(num_arguments, scratch); 1067
1068 __ mov(a2, frame_pointer()); 1068 __ mov(a2, frame_pointer());
1069 // Code* of self. 1069 // Code* of self.
1070 __ li(a1, Operand(masm_->CodeObject()), CONSTANT_SIZE); 1070 __ li(a1, Operand(masm_->CodeObject()), CONSTANT_SIZE);
1071 // a0 becomes return address pointer. 1071
1072 // We need to make room for the return address on the stack.
1073 int stack_alignment = OS::ActivationFrameAlignment();
1074 ASSERT(IsAligned(stack_alignment, kPointerSize));
1075 __ Subu(sp, sp, Operand(stack_alignment));
1076
1077 // a0 will point to the return address, placed by DirectCEntry.
1078 __ mov(a0, sp);
1079
1072 ExternalReference stack_guard_check = 1080 ExternalReference stack_guard_check =
1073 ExternalReference::re_check_stack_guard_state(masm_->isolate()); 1081 ExternalReference::re_check_stack_guard_state(masm_->isolate());
1074 CallCFunctionUsingStub(stack_guard_check, num_arguments); 1082 __ li(t9, Operand(stack_guard_check));
1083 DirectCEntryStub stub;
1084 stub.GenerateCall(masm_, t9);
1085
1086 ASSERT(stack_alignment != 0);
1087 // Drop the return address, stack alignment, C arguments from the stack
1088 // with loading saved sp.
1089 __ lw(sp, MemOperand(sp, 16 + stack_alignment + kCArgsSlotsSize));
Paul Lind 2013/09/19 18:07:10 Where does the magic number 16 come from? You're c
kilvadyb 2013/09/19 18:37:26 The 16 comes from the allocation done by PrepareCa
1090
1091 __ li(code_pointer(), Operand(masm_->CodeObject()));
1075 } 1092 }
1076 1093
1077 1094
1078 // Helper function for reading a value out of a stack frame. 1095 // Helper function for reading a value out of a stack frame.
1079 template <typename T> 1096 template <typename T>
1080 static T& frame_entry(Address re_frame, int frame_offset) { 1097 static T& frame_entry(Address re_frame, int frame_offset) {
1081 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); 1098 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
1082 } 1099 }
1083 1100
1084 1101
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 void RegExpMacroAssemblerMIPS::CheckStackLimit() { 1286 void RegExpMacroAssemblerMIPS::CheckStackLimit() {
1270 ExternalReference stack_limit = 1287 ExternalReference stack_limit =
1271 ExternalReference::address_of_regexp_stack_limit(masm_->isolate()); 1288 ExternalReference::address_of_regexp_stack_limit(masm_->isolate());
1272 1289
1273 __ li(a0, Operand(stack_limit)); 1290 __ li(a0, Operand(stack_limit));
1274 __ lw(a0, MemOperand(a0)); 1291 __ lw(a0, MemOperand(a0));
1275 SafeCall(&stack_overflow_label_, ls, backtrack_stackpointer(), Operand(a0)); 1292 SafeCall(&stack_overflow_label_, ls, backtrack_stackpointer(), Operand(a0));
1276 } 1293 }
1277 1294
1278 1295
1279 void RegExpMacroAssemblerMIPS::CallCFunctionUsingStub(
1280 ExternalReference function,
1281 int num_arguments) {
1282 // Must pass all arguments in registers. The stub pushes on the stack.
1283 ASSERT(num_arguments <= 4);
1284 __ li(code_pointer(), Operand(function));
1285 RegExpCEntryStub stub;
1286 __ CallStub(&stub);
1287 if (OS::ActivationFrameAlignment() != 0) {
1288 __ lw(sp, MemOperand(sp, 16));
1289 }
1290 __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE);
1291 }
1292
1293
1294 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset, 1296 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset,
1295 int characters) { 1297 int characters) {
1296 Register offset = current_input_offset(); 1298 Register offset = current_input_offset();
1297 if (cp_offset != 0) { 1299 if (cp_offset != 0) {
1298 // t7 is not being used to store the capture start index at this point. 1300 // t7 is not being used to store the capture start index at this point.
1299 __ Addu(t7, current_input_offset(), Operand(cp_offset * char_size())); 1301 __ Addu(t7, current_input_offset(), Operand(cp_offset * char_size()));
1300 offset = t7; 1302 offset = t7;
1301 } 1303 }
1302 // We assume that we cannot do unaligned loads on MIPS, so this function 1304 // We assume that we cannot do unaligned loads on MIPS, so this function
1303 // must only be used to load a single character at a time. 1305 // must only be used to load a single character at a time.
1304 ASSERT(characters == 1); 1306 ASSERT(characters == 1);
1305 __ Addu(t5, end_of_input_address(), Operand(offset)); 1307 __ Addu(t5, end_of_input_address(), Operand(offset));
1306 if (mode_ == ASCII) { 1308 if (mode_ == ASCII) {
1307 __ lbu(current_character(), MemOperand(t5, 0)); 1309 __ lbu(current_character(), MemOperand(t5, 0));
1308 } else { 1310 } else {
1309 ASSERT(mode_ == UC16); 1311 ASSERT(mode_ == UC16);
1310 __ lhu(current_character(), MemOperand(t5, 0)); 1312 __ lhu(current_character(), MemOperand(t5, 0));
1311 } 1313 }
1312 } 1314 }
1313 1315
1314 1316
1315 void RegExpCEntryStub::Generate(MacroAssembler* masm_) {
1316 int stack_alignment = OS::ActivationFrameAlignment();
1317 if (stack_alignment < kPointerSize) stack_alignment = kPointerSize;
1318 // Stack is already aligned for call, so decrement by alignment
1319 // to make room for storing the return address.
1320 __ Subu(sp, sp, Operand(stack_alignment + kCArgsSlotsSize));
1321 const int return_address_offset = kCArgsSlotsSize;
1322 __ Addu(a0, sp, return_address_offset);
1323 __ sw(ra, MemOperand(a0, 0));
1324 __ mov(t9, t1);
1325 __ Call(t9);
1326 __ lw(ra, MemOperand(sp, return_address_offset));
1327 __ Addu(sp, sp, Operand(stack_alignment + kCArgsSlotsSize));
1328 __ Jump(ra);
1329 }
1330
1331
1332 #undef __ 1317 #undef __
1333 1318
1334 #endif // V8_INTERPRETED_REGEXP 1319 #endif // V8_INTERPRETED_REGEXP
1335 1320
1336 }} // namespace v8::internal 1321 }} // namespace v8::internal
1337 1322
1338 #endif // V8_TARGET_ARCH_MIPS 1323 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/regexp-macro-assembler-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698