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

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

Issue 660184: Implemented one-char cache lookup in generated code. (Closed)
Patch Set: Created 10 years, 10 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 unified diff | Download patch
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 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 __ jmp(&try_again_with_new_string); 3407 __ jmp(&try_again_with_new_string);
3408 3408
3409 __ bind(&slow); 3409 __ bind(&slow);
3410 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 3410 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
3411 3411
3412 __ bind(&end); 3412 __ bind(&end);
3413 frame_->EmitPush(r0); 3413 frame_->EmitPush(r0);
3414 } 3414 }
3415 3415
3416 3416
3417 void CodeGenerator::GenerateCharFromCode(ZoneList<Expression*>* args) {
3418 Comment(masm_, "[ GenerateCharFromCode");
3419 ASSERT(args->length() == 1);
3420
3421 LoadAndSpill(args->at(0));
3422 frame_->EmitPop(r0);
3423
3424 JumpTarget slow_case;
3425 JumpTarget exit;
3426
3427 // Fast case of Heap::LookupSingleCharacterStringFromCode.
3428 ASSERT(kSmiTag == 0);
3429 ASSERT(kSmiShiftSize == 0);
3430 ASSERT(IsPowerOf2(String::kMaxAsciiCharCode + 1));
3431 __ tst(r0, Operand(kSmiTagMask |
3432 ((~String::kMaxAsciiCharCode) << kSmiTagSize)));
3433 slow_case.Branch(nz);
3434
3435 ASSERT(kSmiTag == 0);
3436 ASSERT(kSmiTagSize == 1);
3437 ASSERT(kSmiShiftSize == 0);
3438 __ mov(r1, Operand(Factory::single_character_string_cache()));
3439 __ add(r1, r1, Operand(r0));
Mads Ager (chromium) 2010/02/26 17:59:06 I would prefer to use __ add(r1, r1, Operand(r0,
Vitaly Repeshko 2010/02/26 20:14:48 Done.
3440 __ add(r1, r1, Operand(r0));
3441 __ ldr(r1, MemOperand(r1, FixedArray::kHeaderSize - kHeapObjectTag));
3442 __ cmp(r1, Operand(Factory::undefined_value()));
Mads Ager (chromium) 2010/02/26 17:59:06 You should use LoadRoot to ip followed by cmp here
Vitaly Repeshko 2010/02/26 20:14:48 Done.
3443 slow_case.Branch(eq);
3444
3445 frame_->EmitPush(r1);
3446 exit.Jump();
3447
3448 slow_case.Bind();
3449 frame_->EmitPush(r0);
3450 frame_->CallRuntime(Runtime::kCharFromCode, 1);
3451 frame_->EmitPush(r0);
3452
3453 exit.Bind();
3454 }
3455
3456
3417 void CodeGenerator::GenerateIsArray(ZoneList<Expression*>* args) { 3457 void CodeGenerator::GenerateIsArray(ZoneList<Expression*>* args) {
3418 VirtualFrame::SpilledScope spilled_scope; 3458 VirtualFrame::SpilledScope spilled_scope;
3419 ASSERT(args->length() == 1); 3459 ASSERT(args->length() == 1);
3420 LoadAndSpill(args->at(0)); 3460 LoadAndSpill(args->at(0));
3421 JumpTarget answer; 3461 JumpTarget answer;
3422 // We need the CC bits to come out as not_equal in the case where the 3462 // We need the CC bits to come out as not_equal in the case where the
3423 // object is a smi. This can't be done with the usual test opcode so 3463 // object is a smi. This can't be done with the usual test opcode so
3424 // we use XOR to get the right CC bits. 3464 // we use XOR to get the right CC bits.
3425 frame_->EmitPop(r0); 3465 frame_->EmitPop(r0);
3426 __ and_(r1, r0, Operand(kSmiTagMask)); 3466 __ and_(r1, r0, Operand(kSmiTagMask));
(...skipping 4236 matching lines...) Expand 10 before | Expand all | Expand 10 after
7663 7703
7664 // Just jump to runtime to add the two strings. 7704 // Just jump to runtime to add the two strings.
7665 __ bind(&string_add_runtime); 7705 __ bind(&string_add_runtime);
7666 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 7706 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
7667 } 7707 }
7668 7708
7669 7709
7670 #undef __ 7710 #undef __
7671 7711
7672 } } // namespace v8::internal 7712 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/codegen.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698