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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 1573243009: [builtins] Migrate Number constructor similar to String constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 4922 matching lines...) Expand 10 before | Expand all | Expand 10 after
4933 // Allocate heap number in new space. 4933 // Allocate heap number in new space.
4934 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, 4934 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
4935 TAG_OBJECT); 4935 TAG_OBJECT);
4936 4936
4937 // Set the map. The other fields are left uninitialized. 4937 // Set the map. The other fields are left uninitialized.
4938 LoadRoot(kScratchRegister, Heap::kSlicedOneByteStringMapRootIndex); 4938 LoadRoot(kScratchRegister, Heap::kSlicedOneByteStringMapRootIndex);
4939 movp(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister); 4939 movp(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
4940 } 4940 }
4941 4941
4942 4942
4943 void MacroAssembler::AllocateJSValue(Register result, Register constructor,
4944 Register value, Register scratch,
4945 Label* gc_required) {
4946 DCHECK(!result.is(constructor));
4947 DCHECK(!result.is(scratch));
4948 DCHECK(!result.is(value));
4949
4950 // Allocate JSValue in new space.
4951 Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT);
4952
4953 // Initialize the JSValue.
4954 LoadGlobalFunctionInitialMap(constructor, scratch);
4955 movp(FieldOperand(result, HeapObject::kMapOffset), scratch);
4956 LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex);
4957 movp(FieldOperand(result, JSObject::kPropertiesOffset), scratch);
4958 movp(FieldOperand(result, JSObject::kElementsOffset), scratch);
4959 movp(FieldOperand(result, JSValue::kValueOffset), value);
4960 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
4961 }
4962
4963
4943 // Copy memory, byte-by-byte, from source to destination. Not optimized for 4964 // Copy memory, byte-by-byte, from source to destination. Not optimized for
4944 // long or aligned copies. The contents of scratch and length are destroyed. 4965 // long or aligned copies. The contents of scratch and length are destroyed.
4945 // Destination is incremented by length, source, length and scratch are 4966 // Destination is incremented by length, source, length and scratch are
4946 // clobbered. 4967 // clobbered.
4947 // A simpler loop is faster on small copies, but slower on large ones. 4968 // A simpler loop is faster on small copies, but slower on large ones.
4948 // The cld() instruction must have been emitted, to set the direction flag(), 4969 // The cld() instruction must have been emitted, to set the direction flag(),
4949 // before calling this function. 4970 // before calling this function.
4950 void MacroAssembler::CopyBytes(Register destination, 4971 void MacroAssembler::CopyBytes(Register destination,
4951 Register source, 4972 Register source,
4952 Register length, 4973 Register length,
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
5457 movl(rax, dividend); 5478 movl(rax, dividend);
5458 shrl(rax, Immediate(31)); 5479 shrl(rax, Immediate(31));
5459 addl(rdx, rax); 5480 addl(rdx, rax);
5460 } 5481 }
5461 5482
5462 5483
5463 } // namespace internal 5484 } // namespace internal
5464 } // namespace v8 5485 } // namespace v8
5465 5486
5466 #endif // V8_TARGET_ARCH_X64 5487 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698