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

Unified Diff: src/ia32/codegen-ia32.cc

Issue 652224: Proof-of-concept RegExp-cache for exec, test, replace. (Closed)
Patch Set: Cache regexp operations. Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/regexp-delay.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/codegen-ia32.cc
diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc
index 312d6e73575a2ebaaa59d24b843d501c6083bbd6..d563088cae5eb66d3edd3de4fd1ea67698d4ecfa 100644
--- a/src/ia32/codegen-ia32.cc
+++ b/src/ia32/codegen-ia32.cc
@@ -5844,6 +5844,65 @@ void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) {
}
+void CodeGenerator::GenerateIsIdentical(ZoneList<Expression*>* args) {
+ ASSERT_EQ(args->length(), 2);
+ JumpTarget failure;
+ JumpTarget done;
+
+ Load(args->at(0));
+ Load(args->at(1));
+
+ Result arg2 = frame_->Pop();
+ Result arg1 = frame_->Pop();
+ arg2.ToRegister();
+ arg1.ToRegister();
+ __ cmp(arg1.reg(), Operand(arg2.reg()));
+ arg1.Unuse();
+ arg2.Unuse();
+ failure.Branch(not_equal);
+
+ frame_->Push(Factory::true_value());
+ done.Jump();
+
+ failure.Bind();
+ frame_->Push(Factory::false_value());
+ done.Bind();
+}
+
+
+void CodeGenerator::GenerateRegExpId(ZoneList<Expression*>* args) {
+ // If passed a JSRegExp, return a value that uniquely identifies
+ // the regexp's behavior (i.e., two regexps returning the same value
+ // will also behave the same). Otherwise, return some arbitrary value.
+ ASSERT_EQ(args->length(), 1);
+ Label done;
+ Load(args->at(0));
+ Result arg = frame_->Pop();
+ arg.ToRegister();
+ frame_->Spill(arg.reg());
+ Result tmp = allocator()->Allocate();
+ ASSERT(tmp.is_valid());
+
+ ASSERT_EQ(0, kSmiTag);
+ ASSERT_EQ(1, kSmiTagMask);
+ __ test(arg.reg(), Immediate(kSmiTagMask));
+ __ j(zero, &done);
+ __ mov(tmp.reg(), FieldOperand(arg.reg(), HeapObject::kMapOffset));
+ __ cmpb(FieldOperand(tmp.reg(), Map::kInstanceTypeOffset),
+ static_cast<uint8_t>(JS_REGEXP_TYPE));
+ __ j(not_equal, &done);
+ __ mov(arg.reg(), FieldOperand(arg.reg(), JSRegExp::kDataOffset));
+ ASSERT_EQ(3, kHeapObjectTagMask);
+ ASSERT_EQ(1, kHeapObjectTag);
+ // Convert FixedArray address to smi.
+ __ sar(arg.reg(), 1);
+ __ bind(&done);
+ frame_->Push(arg.reg(), NumberInfo::kSmi);
+ arg.Unuse();
+}
+
+
+
void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
if (CheckForInlineRuntimeCall(node)) {
return;
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/regexp-delay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698