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

Side by Side Diff: src/ia32/codegen-ia32.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/ia32/codegen-ia32.h ('k') | src/regexp.js » ('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 7274 matching lines...) Expand 10 before | Expand all | Expand 10 after
7285 __ bind(&slowcase); 7285 __ bind(&slowcase);
7286 __ CallRuntime(Runtime::kRegExpConstructResult, 3); 7286 __ CallRuntime(Runtime::kRegExpConstructResult, 3);
7287 7287
7288 __ bind(&done); 7288 __ bind(&done);
7289 } 7289 }
7290 frame_->Forget(3); 7290 frame_->Forget(3);
7291 frame_->Push(eax); 7291 frame_->Push(eax);
7292 } 7292 }
7293 7293
7294 7294
7295 void CodeGenerator::GenerateRegExpCloneResult(ZoneList<Expression*>* args) {
7296 ASSERT_EQ(1, args->length());
7297
7298 Load(args->at(0));
7299 Result object_result = frame_->Pop();
7300 object_result.ToRegister(eax);
7301 object_result.Unuse();
7302 {
7303 VirtualFrame::SpilledScope spilled_scope;
7304
7305 Label done;
7306
7307 __ test(eax, Immediate(kSmiTagMask));
7308 __ j(zero, &done);
7309
7310 // Load JSRegExpResult map into edx.
7311 // Arguments to this function should be results of calling RegExp exec,
7312 // which is either an unmodified JSRegExpResult or null. Anything not having
7313 // the unmodified JSRegExpResult map is returned unmodified.
7314 // This also ensures that elements are fast.
7315 __ mov(edx, ContextOperand(esi, Context::GLOBAL_INDEX));
7316 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalContextOffset));
7317 __ mov(edx, ContextOperand(edx, Context::REGEXP_RESULT_MAP_INDEX));
7318 __ cmp(edx, FieldOperand(eax, HeapObject::kMapOffset));
7319 __ j(not_equal, &done);
7320
7321 if (FLAG_debug_code) {
7322 // Check that object really has empty properties array, as the map
7323 // should guarantee.
7324 __ cmp(FieldOperand(eax, JSObject::kPropertiesOffset),
7325 Immediate(Factory::empty_fixed_array()));
7326 __ Check(equal, "JSRegExpResult: default map but non-empty properties.");
7327 }
7328
7329 DeferredAllocateInNewSpace* allocate_fallback =
7330 new DeferredAllocateInNewSpace(JSRegExpResult::kSize,
7331 ebx,
7332 edx.bit() | eax.bit());
7333
7334 // All set, copy the contents to a new object.
7335 __ AllocateInNewSpace(JSRegExpResult::kSize,
7336 ebx,
7337 ecx,
7338 no_reg,
7339 allocate_fallback->entry_label(),
7340 TAG_OBJECT);
7341 __ bind(allocate_fallback->exit_label());
7342
7343 // Copy all fields from eax to ebx.
7344 STATIC_ASSERT(JSRegExpResult::kSize % (2 * kPointerSize) == 0);
7345 // There is an even number of fields, so unroll the loop once
7346 // for efficiency.
7347 for (int i = 0; i < JSRegExpResult::kSize; i += 2 * kPointerSize) {
7348 STATIC_ASSERT(JSObject::kMapOffset % (2 * kPointerSize) == 0);
7349 if (i != JSObject::kMapOffset) {
7350 // The map was already loaded into edx.
7351 __ mov(edx, FieldOperand(eax, i));
7352 }
7353 __ mov(ecx, FieldOperand(eax, i + kPointerSize));
7354
7355 STATIC_ASSERT(JSObject::kElementsOffset % (2 * kPointerSize) == 0);
7356 if (i == JSObject::kElementsOffset) {
7357 // If the elements array isn't empty, make it copy-on-write
7358 // before copying it.
7359 Label empty;
7360 __ cmp(Operand(edx), Immediate(Factory::empty_fixed_array()));
7361 __ j(equal, &empty);
7362 __ mov(FieldOperand(edx, HeapObject::kMapOffset),
7363 Immediate(Factory::fixed_cow_array_map()));
7364 __ bind(&empty);
7365 }
7366 __ mov(FieldOperand(ebx, i), edx);
7367 __ mov(FieldOperand(ebx, i + kPointerSize), ecx);
7368 }
7369 __ mov(eax, ebx);
7370
7371 __ bind(&done);
7372 }
7373 frame_->Push(eax);
7374 }
7375
7376
7377 class DeferredSearchCache: public DeferredCode { 7295 class DeferredSearchCache: public DeferredCode {
7378 public: 7296 public:
7379 DeferredSearchCache(Register dst, Register cache, Register key) 7297 DeferredSearchCache(Register dst, Register cache, Register key)
7380 : dst_(dst), cache_(cache), key_(key) { 7298 : dst_(dst), cache_(cache), key_(key) {
7381 set_comment("[ DeferredSearchCache"); 7299 set_comment("[ DeferredSearchCache");
7382 } 7300 }
7383 7301
7384 virtual void Generate(); 7302 virtual void Generate();
7385 7303
7386 private: 7304 private:
(...skipping 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after
10151 masm.GetCode(&desc); 10069 masm.GetCode(&desc);
10152 // Call the function from C++. 10070 // Call the function from C++.
10153 return FUNCTION_CAST<MemCopyFunction>(buffer); 10071 return FUNCTION_CAST<MemCopyFunction>(buffer);
10154 } 10072 }
10155 10073
10156 #undef __ 10074 #undef __
10157 10075
10158 } } // namespace v8::internal 10076 } } // namespace v8::internal
10159 10077
10160 #endif // V8_TARGET_ARCH_IA32 10078 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698