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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 4308001: Remove regexp caching. (Closed)
Patch Set: Removed RegExpCloneResult Created 10 years, 1 month 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/arm/codegen-arm.h ('k') | src/full-codegen.cc » ('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 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 5478 matching lines...) Expand 10 before | Expand all | Expand 10 after
5489 __ bind(&slowcase); 5489 __ bind(&slowcase);
5490 __ CallRuntime(Runtime::kRegExpConstructResult, 3); 5490 __ CallRuntime(Runtime::kRegExpConstructResult, 3);
5491 5491
5492 __ bind(&done); 5492 __ bind(&done);
5493 } 5493 }
5494 frame_->Forget(3); 5494 frame_->Forget(3);
5495 frame_->EmitPush(r0); 5495 frame_->EmitPush(r0);
5496 } 5496 }
5497 5497
5498 5498
5499 void CodeGenerator::GenerateRegExpCloneResult(ZoneList<Expression*>* args) {
5500 ASSERT_EQ(1, args->length());
5501
5502 Load(args->at(0));
5503 frame_->PopToR0();
5504 {
5505 VirtualFrame::SpilledScope spilled_scope(frame_);
5506
5507 Label done;
5508 Label call_runtime;
5509 __ BranchOnSmi(r0, &done);
5510
5511 // Load JSRegExp map into r1. Check that argument object has this map.
5512 // Arguments to this function should be results of calling RegExp exec,
5513 // which is either an unmodified JSRegExpResult or null. Anything not having
5514 // the unmodified JSRegExpResult map is returned unmodified.
5515 // This also ensures that elements are fast.
5516
5517 __ ldr(r1, ContextOperand(cp, Context::GLOBAL_INDEX));
5518 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalContextOffset));
5519 __ ldr(r1, ContextOperand(r1, Context::REGEXP_RESULT_MAP_INDEX));
5520 __ ldr(ip, FieldMemOperand(r0, HeapObject::kMapOffset));
5521 __ cmp(r1, Operand(ip));
5522 __ b(ne, &done);
5523
5524 if (FLAG_debug_code) {
5525 __ LoadRoot(r2, Heap::kEmptyFixedArrayRootIndex);
5526 __ ldr(ip, FieldMemOperand(r0, JSObject::kPropertiesOffset));
5527 __ cmp(ip, r2);
5528 __ Check(eq, "JSRegExpResult: default map but non-empty properties.");
5529 }
5530
5531 // All set, copy the contents to a new object.
5532 __ AllocateInNewSpace(JSRegExpResult::kSize,
5533 r2,
5534 r3,
5535 r4,
5536 &call_runtime,
5537 NO_ALLOCATION_FLAGS);
5538 // Store RegExpResult map as map of allocated object.
5539 ASSERT(JSRegExpResult::kSize == 6 * kPointerSize);
5540 // Copy all fields (map is already in r1) from (untagged) r0 to r2.
5541 // Change map of elements array (ends up in r4) to be a FixedCOWArray.
5542 __ bic(r0, r0, Operand(kHeapObjectTagMask));
5543 __ ldm(ib, r0, r3.bit() | r4.bit() | r5.bit() | r6.bit() | r7.bit());
5544 __ stm(ia, r2,
5545 r1.bit() | r3.bit() | r4.bit() | r5.bit() | r6.bit() | r7.bit());
5546 ASSERT(JSRegExp::kElementsOffset == 2 * kPointerSize);
5547 // Check whether elements array is empty fixed array, and otherwise make
5548 // it copy-on-write (it never should be empty unless someone is messing
5549 // with the arguments to the runtime function).
5550 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex);
5551 __ add(r0, r2, Operand(kHeapObjectTag)); // Tag result and move it to r0.
5552 __ cmp(r4, ip);
5553 __ b(eq, &done);
5554 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex);
5555 __ str(ip, FieldMemOperand(r4, HeapObject::kMapOffset));
5556 __ b(&done);
5557 __ bind(&call_runtime);
5558 __ push(r0);
5559 __ CallRuntime(Runtime::kRegExpCloneResult, 1);
5560 __ bind(&done);
5561 }
5562 frame_->EmitPush(r0);
5563 }
5564
5565
5566 class DeferredSearchCache: public DeferredCode { 5499 class DeferredSearchCache: public DeferredCode {
5567 public: 5500 public:
5568 DeferredSearchCache(Register dst, Register cache, Register key) 5501 DeferredSearchCache(Register dst, Register cache, Register key)
5569 : dst_(dst), cache_(cache), key_(key) { 5502 : dst_(dst), cache_(cache), key_(key) {
5570 set_comment("[ DeferredSearchCache"); 5503 set_comment("[ DeferredSearchCache");
5571 } 5504 }
5572 5505
5573 virtual void Generate(); 5506 virtual void Generate();
5574 5507
5575 private: 5508 private:
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
7323 BinaryOpIC::GetName(runtime_operands_type_)); 7256 BinaryOpIC::GetName(runtime_operands_type_));
7324 return name_; 7257 return name_;
7325 } 7258 }
7326 7259
7327 7260
7328 #undef __ 7261 #undef __
7329 7262
7330 } } // namespace v8::internal 7263 } } // namespace v8::internal
7331 7264
7332 #endif // V8_TARGET_ARCH_ARM 7265 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698