OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 __ fstp_d(Operand(esp, 0 * kDoubleSize)); | 274 __ fstp_d(Operand(esp, 0 * kDoubleSize)); |
275 // Put the double_exponent parameter in call stack | 275 // Put the double_exponent parameter in call stack |
276 __ fstp_d(Operand(esp, 1 * kDoubleSize)); | 276 __ fstp_d(Operand(esp, 1 * kDoubleSize)); |
277 __ CallCFunction(ExternalReference::power_double_double_function(isolate()), | 277 __ CallCFunction(ExternalReference::power_double_double_function(isolate()), |
278 4); | 278 4); |
279 } | 279 } |
280 // Return value is in st(0) on ia32. | 280 // Return value is in st(0) on ia32. |
281 __ ret(0); | 281 __ ret(0); |
282 } | 282 } |
283 | 283 |
284 void RegExpExecStub::Generate(MacroAssembler* masm) { | |
285 #ifdef V8_INTERPRETED_REGEXP | |
286 // This case is handled prior to the RegExpExecStub call. | |
287 __ Abort(kUnexpectedRegExpExecCall); | |
288 #else // V8_INTERPRETED_REGEXP | |
289 // Isolates: note we add an additional parameter here (isolate pointer). | |
290 static const int kRegExpExecuteArguments = 9; | |
291 __ EnterApiExitFrame(kRegExpExecuteArguments); | |
292 | |
293 // Argument 9: Pass current isolate address. | |
294 __ mov(Operand(esp, 8 * kPointerSize), | |
295 Immediate(ExternalReference::isolate_address(isolate()))); | |
296 | |
297 // Argument 8: Indicate that this is a direct call from JavaScript. | |
298 __ mov(Operand(esp, 7 * kPointerSize), Immediate(1)); | |
299 | |
300 // Argument 7: Start (high end) of backtracking stack memory area. | |
301 ExternalReference address_of_regexp_stack_memory_address = | |
302 ExternalReference::address_of_regexp_stack_memory_address(isolate()); | |
303 ExternalReference address_of_regexp_stack_memory_size = | |
304 ExternalReference::address_of_regexp_stack_memory_size(isolate()); | |
305 __ mov(esi, Operand::StaticVariable(address_of_regexp_stack_memory_address)); | |
306 __ add(esi, Operand::StaticVariable(address_of_regexp_stack_memory_size)); | |
307 __ mov(Operand(esp, 6 * kPointerSize), esi); | |
308 | |
309 // Argument 6: Set the number of capture registers to zero to force global | |
310 // regexps to behave as non-global. This does not affect non-global regexps. | |
311 __ mov(Operand(esp, 5 * kPointerSize), Immediate(0)); | |
312 | |
313 // Argument 5: static offsets vector buffer. | |
314 __ mov(Operand(esp, 4 * kPointerSize), | |
315 Immediate(ExternalReference::address_of_static_offsets_vector( | |
316 isolate()))); | |
317 | |
318 // Argument 4: End of string data | |
319 // Argument 3: Start of string data | |
320 __ mov(Operand(esp, 3 * kPointerSize), | |
321 RegExpExecDescriptor::StringEndRegister()); | |
322 __ mov(Operand(esp, 2 * kPointerSize), | |
323 RegExpExecDescriptor::StringStartRegister()); | |
324 | |
325 // Argument 2: Previous index. | |
326 __ mov(Operand(esp, 1 * kPointerSize), | |
327 RegExpExecDescriptor::LastIndexRegister()); | |
328 | |
329 // Argument 1: Original subject string. | |
330 __ mov(Operand(esp, 0 * kPointerSize), | |
331 RegExpExecDescriptor::StringRegister()); | |
332 | |
333 // Locate the code entry and call it. | |
334 __ add(RegExpExecDescriptor::CodeRegister(), | |
335 Immediate(Code::kHeaderSize - kHeapObjectTag)); | |
336 __ call(RegExpExecDescriptor::CodeRegister()); | |
337 | |
338 // Drop arguments and come back to JS mode. | |
339 __ LeaveApiExitFrame(true); | |
340 | |
341 // TODO(jgruber): Don't tag return value once this is supported by stubs. | |
342 __ SmiTag(eax); | |
343 __ ret(0 * kPointerSize); | |
344 #endif // V8_INTERPRETED_REGEXP | |
345 } | |
346 | |
347 | 284 |
348 static int NegativeComparisonResult(Condition cc) { | 285 static int NegativeComparisonResult(Condition cc) { |
349 DCHECK(cc != equal); | 286 DCHECK(cc != equal); |
350 DCHECK((cc == less) || (cc == less_equal) | 287 DCHECK((cc == less) || (cc == less_equal) |
351 || (cc == greater) || (cc == greater_equal)); | 288 || (cc == greater) || (cc == greater_equal)); |
352 return (cc == greater || cc == greater_equal) ? LESS : GREATER; | 289 return (cc == greater || cc == greater_equal) ? LESS : GREATER; |
353 } | 290 } |
354 | 291 |
355 | 292 |
356 static void CheckInputType(MacroAssembler* masm, Register input, | 293 static void CheckInputType(MacroAssembler* masm, Register input, |
(...skipping 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3544 kStackUnwindSpace, nullptr, return_value_operand, | 3481 kStackUnwindSpace, nullptr, return_value_operand, |
3545 NULL); | 3482 NULL); |
3546 } | 3483 } |
3547 | 3484 |
3548 #undef __ | 3485 #undef __ |
3549 | 3486 |
3550 } // namespace internal | 3487 } // namespace internal |
3551 } // namespace v8 | 3488 } // namespace v8 |
3552 | 3489 |
3553 #endif // V8_TARGET_ARCH_X87 | 3490 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |