OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4730 | 4730 |
4731 Label object_not_null, object_not_null_or_smi; | 4731 Label object_not_null, object_not_null_or_smi; |
4732 __ bind(¬_js_object); | 4732 __ bind(¬_js_object); |
4733 // Before null, smi and string value checks, check that the rhs is a function | 4733 // Before null, smi and string value checks, check that the rhs is a function |
4734 // as for a non-function rhs an exception needs to be thrown. | 4734 // as for a non-function rhs an exception needs to be thrown. |
4735 __ JumpIfSmi(function, &slow); | 4735 __ JumpIfSmi(function, &slow); |
4736 __ CompareObjectType(function, scratch2, scratch, JS_FUNCTION_TYPE); | 4736 __ CompareObjectType(function, scratch2, scratch, JS_FUNCTION_TYPE); |
4737 __ b(ne, &slow); | 4737 __ b(ne, &slow); |
4738 | 4738 |
4739 // Null is not instance of anything. | 4739 // Null is not instance of anything. |
4740 __ cmp(scratch, Operand(FACTORY->null_value())); | 4740 __ cmp(scratch, Operand(masm->isolate()->factory()->null_value())); |
4741 __ b(ne, &object_not_null); | 4741 __ b(ne, &object_not_null); |
4742 __ mov(r0, Operand(Smi::FromInt(1))); | 4742 __ mov(r0, Operand(Smi::FromInt(1))); |
4743 __ Ret(HasArgsInRegisters() ? 0 : 2); | 4743 __ Ret(HasArgsInRegisters() ? 0 : 2); |
4744 | 4744 |
4745 __ bind(&object_not_null); | 4745 __ bind(&object_not_null); |
4746 // Smi values are not instances of anything. | 4746 // Smi values are not instances of anything. |
4747 __ JumpIfNotSmi(object, &object_not_null_or_smi); | 4747 __ JumpIfNotSmi(object, &object_not_null_or_smi); |
4748 __ mov(r0, Operand(Smi::FromInt(1))); | 4748 __ mov(r0, Operand(Smi::FromInt(1))); |
4749 __ Ret(HasArgsInRegisters() ? 0 : 2); | 4749 __ Ret(HasArgsInRegisters() ? 0 : 2); |
4750 | 4750 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5228 Label termination_exception; | 5228 Label termination_exception; |
5229 __ b(eq, &termination_exception); | 5229 __ b(eq, &termination_exception); |
5230 | 5230 |
5231 __ Throw(r0); // Expects thrown value in r0. | 5231 __ Throw(r0); // Expects thrown value in r0. |
5232 | 5232 |
5233 __ bind(&termination_exception); | 5233 __ bind(&termination_exception); |
5234 __ ThrowUncatchable(TERMINATION, r0); // Expects thrown value in r0. | 5234 __ ThrowUncatchable(TERMINATION, r0); // Expects thrown value in r0. |
5235 | 5235 |
5236 __ bind(&failure); | 5236 __ bind(&failure); |
5237 // For failure and exception return null. | 5237 // For failure and exception return null. |
5238 __ mov(r0, Operand(FACTORY->null_value())); | 5238 __ mov(r0, Operand(masm->isolate()->factory()->null_value())); |
5239 __ add(sp, sp, Operand(4 * kPointerSize)); | 5239 __ add(sp, sp, Operand(4 * kPointerSize)); |
5240 __ Ret(); | 5240 __ Ret(); |
5241 | 5241 |
5242 // Process the result from the native regexp code. | 5242 // Process the result from the native regexp code. |
5243 __ bind(&success); | 5243 __ bind(&success); |
5244 __ ldr(r1, | 5244 __ ldr(r1, |
5245 FieldMemOperand(regexp_data, JSRegExp::kIrregexpCaptureCountOffset)); | 5245 FieldMemOperand(regexp_data, JSRegExp::kIrregexpCaptureCountOffset)); |
5246 // Calculate number of capture registers (number_of_captures + 1) * 2. | 5246 // Calculate number of capture registers (number_of_captures + 1) * 2. |
5247 STATIC_ASSERT(kSmiTag == 0); | 5247 STATIC_ASSERT(kSmiTag == 0); |
5248 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1); | 5248 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5299 __ bind(&runtime); | 5299 __ bind(&runtime); |
5300 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); | 5300 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); |
5301 #endif // V8_INTERPRETED_REGEXP | 5301 #endif // V8_INTERPRETED_REGEXP |
5302 } | 5302 } |
5303 | 5303 |
5304 | 5304 |
5305 void RegExpConstructResultStub::Generate(MacroAssembler* masm) { | 5305 void RegExpConstructResultStub::Generate(MacroAssembler* masm) { |
5306 const int kMaxInlineLength = 100; | 5306 const int kMaxInlineLength = 100; |
5307 Label slowcase; | 5307 Label slowcase; |
5308 Label done; | 5308 Label done; |
| 5309 Factory* factory = masm->isolate()->factory(); |
| 5310 |
5309 __ ldr(r1, MemOperand(sp, kPointerSize * 2)); | 5311 __ ldr(r1, MemOperand(sp, kPointerSize * 2)); |
5310 STATIC_ASSERT(kSmiTag == 0); | 5312 STATIC_ASSERT(kSmiTag == 0); |
5311 STATIC_ASSERT(kSmiTagSize == 1); | 5313 STATIC_ASSERT(kSmiTagSize == 1); |
5312 __ tst(r1, Operand(kSmiTagMask)); | 5314 __ tst(r1, Operand(kSmiTagMask)); |
5313 __ b(ne, &slowcase); | 5315 __ b(ne, &slowcase); |
5314 __ cmp(r1, Operand(Smi::FromInt(kMaxInlineLength))); | 5316 __ cmp(r1, Operand(Smi::FromInt(kMaxInlineLength))); |
5315 __ b(hi, &slowcase); | 5317 __ b(hi, &slowcase); |
5316 // Smi-tagging is equivalent to multiplying by 2. | 5318 // Smi-tagging is equivalent to multiplying by 2. |
5317 // Allocate RegExpResult followed by FixedArray with size in ebx. | 5319 // Allocate RegExpResult followed by FixedArray with size in ebx. |
5318 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] | 5320 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] |
(...skipping 14 matching lines...) Expand all Loading... |
5333 // r0: Start of allocated area, object-tagged. | 5335 // r0: Start of allocated area, object-tagged. |
5334 // r1: Number of elements in array, as smi. | 5336 // r1: Number of elements in array, as smi. |
5335 // r5: Number of elements, untagged. | 5337 // r5: Number of elements, untagged. |
5336 | 5338 |
5337 // Set JSArray map to global.regexp_result_map(). | 5339 // Set JSArray map to global.regexp_result_map(). |
5338 // Set empty properties FixedArray. | 5340 // Set empty properties FixedArray. |
5339 // Set elements to point to FixedArray allocated right after the JSArray. | 5341 // Set elements to point to FixedArray allocated right after the JSArray. |
5340 // Interleave operations for better latency. | 5342 // Interleave operations for better latency. |
5341 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_INDEX)); | 5343 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_INDEX)); |
5342 __ add(r3, r0, Operand(JSRegExpResult::kSize)); | 5344 __ add(r3, r0, Operand(JSRegExpResult::kSize)); |
5343 __ mov(r4, Operand(FACTORY->empty_fixed_array())); | 5345 __ mov(r4, Operand(factory->empty_fixed_array())); |
5344 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset)); | 5346 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset)); |
5345 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); | 5347 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); |
5346 __ ldr(r2, ContextOperand(r2, Context::REGEXP_RESULT_MAP_INDEX)); | 5348 __ ldr(r2, ContextOperand(r2, Context::REGEXP_RESULT_MAP_INDEX)); |
5347 __ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | 5349 __ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
5348 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 5350 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
5349 | 5351 |
5350 // Set input, index and length fields from arguments. | 5352 // Set input, index and length fields from arguments. |
5351 __ ldr(r1, MemOperand(sp, kPointerSize * 0)); | 5353 __ ldr(r1, MemOperand(sp, kPointerSize * 0)); |
5352 __ str(r1, FieldMemOperand(r0, JSRegExpResult::kInputOffset)); | 5354 __ str(r1, FieldMemOperand(r0, JSRegExpResult::kInputOffset)); |
5353 __ ldr(r1, MemOperand(sp, kPointerSize * 1)); | 5355 __ ldr(r1, MemOperand(sp, kPointerSize * 1)); |
5354 __ str(r1, FieldMemOperand(r0, JSRegExpResult::kIndexOffset)); | 5356 __ str(r1, FieldMemOperand(r0, JSRegExpResult::kIndexOffset)); |
5355 __ ldr(r1, MemOperand(sp, kPointerSize * 2)); | 5357 __ ldr(r1, MemOperand(sp, kPointerSize * 2)); |
5356 __ str(r1, FieldMemOperand(r0, JSArray::kLengthOffset)); | 5358 __ str(r1, FieldMemOperand(r0, JSArray::kLengthOffset)); |
5357 | 5359 |
5358 // Fill out the elements FixedArray. | 5360 // Fill out the elements FixedArray. |
5359 // r0: JSArray, tagged. | 5361 // r0: JSArray, tagged. |
5360 // r3: FixedArray, tagged. | 5362 // r3: FixedArray, tagged. |
5361 // r5: Number of elements in array, untagged. | 5363 // r5: Number of elements in array, untagged. |
5362 | 5364 |
5363 // Set map. | 5365 // Set map. |
5364 __ mov(r2, Operand(FACTORY->fixed_array_map())); | 5366 __ mov(r2, Operand(factory->fixed_array_map())); |
5365 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 5367 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
5366 // Set FixedArray length. | 5368 // Set FixedArray length. |
5367 __ mov(r6, Operand(r5, LSL, kSmiTagSize)); | 5369 __ mov(r6, Operand(r5, LSL, kSmiTagSize)); |
5368 __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 5370 __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
5369 // Fill contents of fixed-array with the-hole. | 5371 // Fill contents of fixed-array with the-hole. |
5370 __ mov(r2, Operand(FACTORY->the_hole_value())); | 5372 __ mov(r2, Operand(factory->the_hole_value())); |
5371 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 5373 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
5372 // Fill fixed array elements with hole. | 5374 // Fill fixed array elements with hole. |
5373 // r0: JSArray, tagged. | 5375 // r0: JSArray, tagged. |
5374 // r2: the hole. | 5376 // r2: the hole. |
5375 // r3: Start of elements in FixedArray. | 5377 // r3: Start of elements in FixedArray. |
5376 // r5: Number of elements to fill. | 5378 // r5: Number of elements to fill. |
5377 Label loop; | 5379 Label loop; |
5378 __ tst(r5, Operand(r5)); | 5380 __ tst(r5, Operand(r5)); |
5379 __ bind(&loop); | 5381 __ bind(&loop); |
5380 __ b(le, &done); // Jump if r1 is negative or zero. | 5382 __ b(le, &done); // Jump if r1 is negative or zero. |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6908 __ str(pc, MemOperand(sp, 0)); | 6910 __ str(pc, MemOperand(sp, 0)); |
6909 __ Jump(target); // Call the C++ function. | 6911 __ Jump(target); // Call the C++ function. |
6910 } | 6912 } |
6911 | 6913 |
6912 | 6914 |
6913 #undef __ | 6915 #undef __ |
6914 | 6916 |
6915 } } // namespace v8::internal | 6917 } } // namespace v8::internal |
6916 | 6918 |
6917 #endif // V8_TARGET_ARCH_ARM | 6919 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |