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

Side by Side Diff: src/crankshaft/arm64/lithium-codegen-arm64.cc

Issue 1475823003: [runtime] First step to sanitize regexp literal creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/crankshaft/arm64/lithium-codegen-arm64.h" 5 #include "src/crankshaft/arm64/lithium-codegen-arm64.h"
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 5546 matching lines...) Expand 10 before | Expand all | Expand 10 after
5557 5557
5558 5558
5559 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { 5559 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5560 DCHECK(ToRegister(instr->value()).Is(x0)); 5560 DCHECK(ToRegister(instr->value()).Is(x0));
5561 DCHECK(ToRegister(instr->result()).Is(x0)); 5561 DCHECK(ToRegister(instr->result()).Is(x0));
5562 __ Push(x0); 5562 __ Push(x0);
5563 CallRuntime(Runtime::kToFastProperties, 1, instr); 5563 CallRuntime(Runtime::kToFastProperties, 1, instr);
5564 } 5564 }
5565 5565
5566 5566
5567 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
5568 DCHECK(ToRegister(instr->context()).is(cp));
5569 Label materialized;
5570 // Registers will be used as follows:
5571 // x7 = literals array.
5572 // x1 = regexp literal.
5573 // x0 = regexp literal clone.
5574 // x10-x12 are used as temporaries.
5575 int literal_offset =
5576 LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index());
5577 __ LoadObject(x7, instr->hydrogen()->literals());
5578 __ Ldr(x1, FieldMemOperand(x7, literal_offset));
5579 __ JumpIfNotRoot(x1, Heap::kUndefinedValueRootIndex, &materialized);
5580
5581 // Create regexp literal using runtime function
5582 // Result will be in x0.
5583 __ Mov(x12, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
5584 __ Mov(x11, Operand(instr->hydrogen()->pattern()));
5585 __ Mov(x10, Operand(instr->hydrogen()->flags()));
5586 __ Push(x7, x12, x11, x10);
5587 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr);
5588 __ Mov(x1, x0);
5589
5590 __ Bind(&materialized);
5591 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
5592 Label allocated, runtime_allocate;
5593
5594 __ Allocate(size, x0, x10, x11, &runtime_allocate, TAG_OBJECT);
5595 __ B(&allocated);
5596
5597 __ Bind(&runtime_allocate);
5598 __ Mov(x0, Smi::FromInt(size));
5599 __ Push(x1, x0);
5600 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
5601 __ Pop(x1);
5602
5603 __ Bind(&allocated);
5604 // Copy the content into the newly allocated memory.
5605 __ CopyFields(x0, x1, CPURegList(x10, x11, x12), size / kPointerSize);
5606 }
5607
5608
5609 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { 5567 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
5610 Register object = ToRegister(instr->object()); 5568 Register object = ToRegister(instr->object());
5611 5569
5612 Handle<Map> from_map = instr->original_map(); 5570 Handle<Map> from_map = instr->original_map();
5613 Handle<Map> to_map = instr->transitioned_map(); 5571 Handle<Map> to_map = instr->transitioned_map();
5614 ElementsKind from_kind = instr->from_kind(); 5572 ElementsKind from_kind = instr->from_kind();
5615 ElementsKind to_kind = instr->to_kind(); 5573 ElementsKind to_kind = instr->to_kind();
5616 5574
5617 Label not_applicable; 5575 Label not_applicable;
5618 5576
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
5937 Handle<ScopeInfo> scope_info = instr->scope_info(); 5895 Handle<ScopeInfo> scope_info = instr->scope_info();
5938 __ Push(scope_info); 5896 __ Push(scope_info);
5939 __ Push(ToRegister(instr->function())); 5897 __ Push(ToRegister(instr->function()));
5940 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5898 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5941 RecordSafepoint(Safepoint::kNoLazyDeopt); 5899 RecordSafepoint(Safepoint::kNoLazyDeopt);
5942 } 5900 }
5943 5901
5944 5902
5945 } // namespace internal 5903 } // namespace internal
5946 } // namespace v8 5904 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698