Revision: 12895
Author: [email protected]
Date: Thu Nov 8 02:32:39 2012
Log: Use movw/movt on ARM to load constant roots
BUG=none
TEST=none
Review URL: https://codereview.chromium.org/11307012
Patch from Jay Conrod <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12895
Modified:
/branches/bleeding_edge/src/arm/macro-assembler-arm.cc
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Fri Oct 19
05:39:59 2012
+++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Thu Nov 8
02:32:39 2012
@@ -422,6 +422,16 @@
void MacroAssembler::LoadRoot(Register destination,
Heap::RootListIndex index,
Condition cond) {
+ if (CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) &&
+ !Heap::RootCanBeWrittenAfterInitialization(index)) {
+ Handle<Object> root(isolate()->heap()->roots_array_start()[index]);
+ if (!isolate()->heap()->InNewSpace(*root)) {
+ // The CPU supports fast immediate values, and this root will never
+ // change. We will load it as a relocatable immediate value.
+ mov(destination, Operand(root), LeaveCC, cond);
+ return;
+ }
+ }
ldr(destination, MemOperand(kRootRegister, index << kPointerSizeLog2),
cond);
}
=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Nov 6 09:32:15 2012
+++ /branches/bleeding_edge/src/heap.cc Thu Nov 8 02:32:39 2012
@@ -2929,6 +2929,34 @@
return true;
}
+
+
+bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex
root_index) {
+ RootListIndex writable_roots[] = {
+ kStoreBufferTopRootIndex,
+ kStackLimitRootIndex,
+ kInstanceofCacheFunctionRootIndex,
+ kInstanceofCacheMapRootIndex,
+ kInstanceofCacheAnswerRootIndex,
+ kCodeStubsRootIndex,
+ kNonMonomorphicCacheRootIndex,
+ kPolymorphicCodeCacheRootIndex,
+ kLastScriptIdRootIndex,
+ kEmptyScriptRootIndex,
+ kRealStackLimitRootIndex,
+ kArgumentsAdaptorDeoptPCOffsetRootIndex,
+ kConstructStubDeoptPCOffsetRootIndex,
+ kGetterStubDeoptPCOffsetRootIndex,
+ kSetterStubDeoptPCOffsetRootIndex,
+ kSymbolTableRootIndex,
+ };
+
+ for (unsigned int i = 0; i < ARRAY_SIZE(writable_roots); i++) {
+ if (root_index == writable_roots[i])
+ return true;
+ }
+ return false;
+}
Object* RegExpResultsCache::Lookup(Heap* heap,
=======================================
--- /branches/bleeding_edge/src/heap.h Tue Nov 6 09:32:15 2012
+++ /branches/bleeding_edge/src/heap.h Thu Nov 8 02:32:39 2012
@@ -1456,6 +1456,10 @@
STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex);
STATIC_CHECK(kempty_symbolRootIndex == Internals::kEmptySymbolRootIndex);
+ // Generated code can embed direct references to non-writable roots if
+ // they are in new space.
+ static bool RootCanBeWrittenAfterInitialization(RootListIndex
root_index);
+
MUST_USE_RESULT MaybeObject* NumberToString(
Object* number, bool check_number_string_cache = true);
MUST_USE_RESULT MaybeObject* Uint32ToString(
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev