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

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

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 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
« no previous file with comments | « src/x64/codegen-x64.h ('k') | src/x64/cpu-x64.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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void VirtualFrameRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { 97 void VirtualFrameRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const {
98 frame_state_->Save(masm); 98 frame_state_->Save(masm);
99 } 99 }
100 100
101 101
102 void VirtualFrameRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { 102 void VirtualFrameRuntimeCallHelper::AfterCall(MacroAssembler* masm) const {
103 frame_state_->Restore(masm); 103 frame_state_->Restore(masm);
104 } 104 }
105 105
106 106
107 void ICRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { 107 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const {
108 masm->EnterInternalFrame(); 108 masm->EnterInternalFrame();
109 } 109 }
110 110
111 111
112 void ICRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { 112 void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const {
113 masm->LeaveInternalFrame(); 113 masm->LeaveInternalFrame();
114 } 114 }
115 115
116 116
117 // ------------------------------------------------------------------------- 117 // -------------------------------------------------------------------------
118 // CodeGenState implementation. 118 // CodeGenState implementation.
119 119
120 CodeGenState::CodeGenState(CodeGenerator* owner) 120 CodeGenState::CodeGenState(CodeGenerator* owner)
121 : owner_(owner), 121 : owner_(owner),
122 destination_(NULL), 122 destination_(NULL),
(...skipping 6361 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 Load(args->at(1)); 6484 Load(args->at(1));
6485 Load(args->at(2)); 6485 Load(args->at(2));
6486 Load(args->at(3)); 6486 Load(args->at(3));
6487 RegExpExecStub stub; 6487 RegExpExecStub stub;
6488 Result result = frame_->CallStub(&stub, 4); 6488 Result result = frame_->CallStub(&stub, 4);
6489 frame_->Push(&result); 6489 frame_->Push(&result);
6490 } 6490 }
6491 6491
6492 6492
6493 void CodeGenerator::GenerateRegExpConstructResult(ZoneList<Expression*>* args) { 6493 void CodeGenerator::GenerateRegExpConstructResult(ZoneList<Expression*>* args) {
6494 // No stub. This code only occurs a few times in regexp.js.
6495 const int kMaxInlineLength = 100;
6496 ASSERT_EQ(3, args->length()); 6494 ASSERT_EQ(3, args->length());
6497 Load(args->at(0)); // Size of array, smi. 6495 Load(args->at(0)); // Size of array, smi.
6498 Load(args->at(1)); // "index" property value. 6496 Load(args->at(1)); // "index" property value.
6499 Load(args->at(2)); // "input" property value. 6497 Load(args->at(2)); // "input" property value.
6500 { 6498 RegExpConstructResultStub stub;
6501 VirtualFrame::SpilledScope spilled_scope; 6499 Result result = frame_->CallStub(&stub, 3);
6502 6500 frame_->Push(&result);
6503 Label slowcase;
6504 Label done;
6505 __ movq(r8, Operand(rsp, kPointerSize * 2));
6506 __ JumpIfNotSmi(r8, &slowcase);
6507 __ SmiToInteger32(rbx, r8);
6508 __ cmpl(rbx, Immediate(kMaxInlineLength));
6509 __ j(above, &slowcase);
6510 // Smi-tagging is equivalent to multiplying by 2.
6511 STATIC_ASSERT(kSmiTag == 0);
6512 STATIC_ASSERT(kSmiTagSize == 1);
6513 // Allocate RegExpResult followed by FixedArray with size in ebx.
6514 // JSArray: [Map][empty properties][Elements][Length-smi][index][input]
6515 // Elements: [Map][Length][..elements..]
6516 __ AllocateInNewSpace(JSRegExpResult::kSize + FixedArray::kHeaderSize,
6517 times_pointer_size,
6518 rbx, // In: Number of elements.
6519 rax, // Out: Start of allocation (tagged).
6520 rcx, // Out: End of allocation.
6521 rdx, // Scratch register
6522 &slowcase,
6523 TAG_OBJECT);
6524 // rax: Start of allocated area, object-tagged.
6525 // rbx: Number of array elements as int32.
6526 // r8: Number of array elements as smi.
6527
6528 // Set JSArray map to global.regexp_result_map().
6529 __ movq(rdx, ContextOperand(rsi, Context::GLOBAL_INDEX));
6530 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset));
6531 __ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX));
6532 __ movq(FieldOperand(rax, HeapObject::kMapOffset), rdx);
6533
6534 // Set empty properties FixedArray.
6535 __ Move(FieldOperand(rax, JSObject::kPropertiesOffset),
6536 FACTORY->empty_fixed_array());
6537
6538 // Set elements to point to FixedArray allocated right after the JSArray.
6539 __ lea(rcx, Operand(rax, JSRegExpResult::kSize));
6540 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rcx);
6541
6542 // Set input, index and length fields from arguments.
6543 __ pop(FieldOperand(rax, JSRegExpResult::kInputOffset));
6544 __ pop(FieldOperand(rax, JSRegExpResult::kIndexOffset));
6545 __ lea(rsp, Operand(rsp, kPointerSize));
6546 __ movq(FieldOperand(rax, JSArray::kLengthOffset), r8);
6547
6548 // Fill out the elements FixedArray.
6549 // rax: JSArray.
6550 // rcx: FixedArray.
6551 // rbx: Number of elements in array as int32.
6552
6553 // Set map.
6554 __ Move(FieldOperand(rcx, HeapObject::kMapOffset),
6555 FACTORY->fixed_array_map());
6556 // Set length.
6557 __ Integer32ToSmi(rdx, rbx);
6558 __ movq(FieldOperand(rcx, FixedArray::kLengthOffset), rdx);
6559 // Fill contents of fixed-array with the-hole.
6560 __ Move(rdx, FACTORY->the_hole_value());
6561 __ lea(rcx, FieldOperand(rcx, FixedArray::kHeaderSize));
6562 // Fill fixed array elements with hole.
6563 // rax: JSArray.
6564 // rbx: Number of elements in array that remains to be filled, as int32.
6565 // rcx: Start of elements in FixedArray.
6566 // rdx: the hole.
6567 Label loop;
6568 __ testl(rbx, rbx);
6569 __ bind(&loop);
6570 __ j(less_equal, &done); // Jump if ecx is negative or zero.
6571 __ subl(rbx, Immediate(1));
6572 __ movq(Operand(rcx, rbx, times_pointer_size, 0), rdx);
6573 __ jmp(&loop);
6574
6575 __ bind(&slowcase);
6576 __ CallRuntime(Runtime::kRegExpConstructResult, 3);
6577
6578 __ bind(&done);
6579 }
6580 frame_->Forget(3);
6581 frame_->Push(rax);
6582 } 6501 }
6583 6502
6584 6503
6585 class DeferredSearchCache: public DeferredCode { 6504 class DeferredSearchCache: public DeferredCode {
6586 public: 6505 public:
6587 DeferredSearchCache(Register dst, 6506 DeferredSearchCache(Register dst,
6588 Register cache, 6507 Register cache,
6589 Register key, 6508 Register key,
6590 Register scratch) 6509 Register scratch)
6591 : dst_(dst), cache_(cache), key_(key), scratch_(scratch) { 6510 : dst_(dst), cache_(cache), key_(key), scratch_(scratch) {
(...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after
8891 #undef __ 8810 #undef __
8892 8811
8893 void RecordWriteStub::Generate(MacroAssembler* masm) { 8812 void RecordWriteStub::Generate(MacroAssembler* masm) {
8894 masm->RecordWriteHelper(object_, addr_, scratch_); 8813 masm->RecordWriteHelper(object_, addr_, scratch_);
8895 masm->ret(0); 8814 masm->ret(0);
8896 } 8815 }
8897 8816
8898 } } // namespace v8::internal 8817 } } // namespace v8::internal
8899 8818
8900 #endif // V8_TARGET_ARCH_X64 8819 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.h ('k') | src/x64/cpu-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698