OLD | NEW |
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 5246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5257 __ bind(&slowcase); | 5257 __ bind(&slowcase); |
5258 __ CallRuntime(Runtime::kRegExpConstructResult, 3); | 5258 __ CallRuntime(Runtime::kRegExpConstructResult, 3); |
5259 | 5259 |
5260 __ bind(&done); | 5260 __ bind(&done); |
5261 } | 5261 } |
5262 frame_->Forget(3); | 5262 frame_->Forget(3); |
5263 frame_->EmitPush(r0); | 5263 frame_->EmitPush(r0); |
5264 } | 5264 } |
5265 | 5265 |
5266 | 5266 |
| 5267 void CodeGenerator::GenerateRegExpCloneResult(ZoneList<Expression*>* args) { |
| 5268 ASSERT_EQ(1, args->length()); |
| 5269 |
| 5270 Load(args->at(0)); |
| 5271 frame_->PopToR0(); |
| 5272 { |
| 5273 VirtualFrame::SpilledScope spilled_scope(frame_); |
| 5274 |
| 5275 Label done; |
| 5276 Label call_runtime; |
| 5277 __ BranchOnSmi(r0, &done); |
| 5278 |
| 5279 // Load JSRegExp map into r1. Check that argument object has this map. |
| 5280 // Arguments to this function should be results of calling RegExp exec, |
| 5281 // which is either an unmodified JSRegExpResult or null. Anything not having |
| 5282 // the unmodified JSRegExpResult map is returned unmodified. |
| 5283 // This also ensures that elements are fast. |
| 5284 |
| 5285 __ ldr(r1, ContextOperand(cp, Context::GLOBAL_INDEX)); |
| 5286 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalContextOffset)); |
| 5287 __ ldr(r1, ContextOperand(r1, Context::REGEXP_RESULT_MAP_INDEX)); |
| 5288 __ ldr(ip, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| 5289 __ cmp(r1, Operand(ip)); |
| 5290 __ b(ne, &done); |
| 5291 |
| 5292 // All set, copy the contents to a new object. |
| 5293 __ AllocateInNewSpace(JSRegExpResult::kSize, |
| 5294 r2, |
| 5295 r3, |
| 5296 r4, |
| 5297 &call_runtime, |
| 5298 NO_ALLOCATION_FLAGS); |
| 5299 // Store RegExpResult map as map of allocated object. |
| 5300 ASSERT(JSRegExpResult::kSize == 6 * kPointerSize); |
| 5301 // Copy all fields (map is already in r1) from (untagged) r0 to r2. |
| 5302 // Change map of elements array (ends up in r4) to be a FixedCOWArray. |
| 5303 __ bic(r0, r0, Operand(kHeapObjectTagMask)); |
| 5304 __ ldm(ib, r0, r3.bit() | r4.bit() | r5.bit() | r6.bit() | r7.bit()); |
| 5305 __ stm(ia, r2, |
| 5306 r1.bit() | r3.bit() | r4.bit() | r5.bit() | r6.bit() | r7.bit()); |
| 5307 ASSERT(!Heap::InNewSpace(Heap::fixed_cow_array_map())); |
| 5308 ASSERT(JSRegExp::kElementsOffset == 2 * kPointerSize); |
| 5309 // Check whether elements array is empty fixed array, and otherwise make |
| 5310 // it copy-on-write (it never should be empty unless someone is messing |
| 5311 // with the arguments to the runtime function). |
| 5312 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); |
| 5313 __ add(r0, r2, Operand(kHeapObjectTag)); // Tag result and move it to r0. |
| 5314 __ cmp(r4, ip); |
| 5315 __ b(eq, &done); |
| 5316 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex); |
| 5317 __ str(ip, FieldMemOperand(r4, HeapObject::kMapOffset)); |
| 5318 __ b(&done); |
| 5319 __ bind(&call_runtime); |
| 5320 __ push(r0); |
| 5321 __ CallRuntime(Runtime::kRegExpCloneResult, 1); |
| 5322 __ bind(&done); |
| 5323 } |
| 5324 frame_->EmitPush(r0); |
| 5325 } |
| 5326 |
| 5327 |
5267 class DeferredSearchCache: public DeferredCode { | 5328 class DeferredSearchCache: public DeferredCode { |
5268 public: | 5329 public: |
5269 DeferredSearchCache(Register dst, Register cache, Register key) | 5330 DeferredSearchCache(Register dst, Register cache, Register key) |
5270 : dst_(dst), cache_(cache), key_(key) { | 5331 : dst_(dst), cache_(cache), key_(key) { |
5271 set_comment("[ DeferredSearchCache"); | 5332 set_comment("[ DeferredSearchCache"); |
5272 } | 5333 } |
5273 | 5334 |
5274 virtual void Generate(); | 5335 virtual void Generate(); |
5275 | 5336 |
5276 private: | 5337 private: |
(...skipping 6421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11698 __ bind(&string_add_runtime); | 11759 __ bind(&string_add_runtime); |
11699 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 11760 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
11700 } | 11761 } |
11701 | 11762 |
11702 | 11763 |
11703 #undef __ | 11764 #undef __ |
11704 | 11765 |
11705 } } // namespace v8::internal | 11766 } } // namespace v8::internal |
11706 | 11767 |
11707 #endif // V8_TARGET_ARCH_ARM | 11768 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |