aboutsummaryrefslogtreecommitdiff
path: root/src/ic/x87
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2016-05-18 12:22:57 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-05-18 12:22:57 +0000
commitc007f9a1597810ec6ccf9b289e98fda574a0dde7 (patch)
treeffd2ec36f46d14a64045fafe1f31fe5f945e6290 /src/ic/x87
parentb7f71747993d419740fd1af340137cee410dca15 (diff)
parent109988c7ccb6f3fd1a58574fa3dfb88beaef6632 (diff)
downloadv8-c007f9a1597810ec6ccf9b289e98fda574a0dde7.tar.gz
Merge "Revert "Revert "Upgrade to 5.0.71.48"""
Diffstat (limited to 'src/ic/x87')
-rw-r--r--src/ic/x87/handler-compiler-x87.cc76
-rw-r--r--src/ic/x87/ic-x87.cc53
2 files changed, 57 insertions, 72 deletions
diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc
index cc43ed29..1b25f063 100644
--- a/src/ic/x87/handler-compiler-x87.cc
+++ b/src/ic/x87/handler-compiler-x87.cc
@@ -4,8 +4,10 @@
#if V8_TARGET_ARCH_X87
-#include "src/ic/call-optimization.h"
#include "src/ic/handler-compiler.h"
+
+#include "src/field-type.h"
+#include "src/ic/call-optimization.h"
#include "src/ic/ic.h"
#include "src/isolate-inl.h"
@@ -197,9 +199,13 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
call_data_undefined = true;
__ mov(data, Immediate(isolate->factory()->undefined_value()));
} else {
- __ mov(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
- __ mov(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
- __ mov(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
+ if (optimization.is_constant_call()) {
+ __ mov(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
+ __ mov(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
+ __ mov(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
+ } else {
+ __ mov(data, FieldOperand(callee, FunctionTemplateInfo::kCallCodeOffset));
+ }
__ mov(data, FieldOperand(data, CallHandlerInfo::kDataOffset));
}
@@ -214,7 +220,8 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ mov(api_function_address, Immediate(function_address));
// Jump to stub.
- CallApiAccessorStub stub(isolate, is_store, call_data_undefined);
+ CallApiAccessorStub stub(isolate, is_store, call_data_undefined,
+ !optimization.is_constant_call());
__ TailCallStub(&stub);
}
@@ -399,8 +406,7 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
__ j(not_equal, miss_label);
}
-
-void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
+void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(FieldType* field_type,
Register value_reg,
Label* miss_label) {
Register map_reg = scratch1();
@@ -408,20 +414,11 @@ void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
DCHECK(!value_reg.is(map_reg));
DCHECK(!value_reg.is(scratch));
__ JumpIfSmi(value_reg, miss_label);
- HeapType::Iterator<Map> it = field_type->Classes();
- if (!it.Done()) {
- Label do_store;
+ if (field_type->IsClass()) {
__ mov(map_reg, FieldOperand(value_reg, HeapObject::kMapOffset));
- while (true) {
- __ CmpWeakValue(map_reg, Map::WeakCellForMap(it.Current()), scratch);
- it.Advance();
- if (it.Done()) {
- __ j(not_equal, miss_label);
- break;
- }
- __ j(equal, &do_store, Label::kNear);
- }
- __ bind(&do_store);
+ __ CmpWeakValue(map_reg, Map::WeakCellForMap(field_type->AsClass()),
+ scratch);
+ __ j(not_equal, miss_label);
}
}
@@ -593,24 +590,30 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
void NamedLoadHandlerCompiler::GenerateLoadCallback(
- Register reg, Handle<ExecutableAccessorInfo> callback) {
+ Register reg, Handle<AccessorInfo> callback) {
+ DCHECK(!AreAliased(scratch2(), scratch3(), receiver()));
+ DCHECK(!AreAliased(scratch2(), scratch3(), reg));
+
// Insert additional parameters into the stack frame above return address.
- DCHECK(!scratch3().is(reg));
__ pop(scratch3()); // Get return address to place it below.
- STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0);
- STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1);
- STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2);
- STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3);
- STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4);
- STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
+ // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
+ // name below the exit frame to make GC aware of them.
+ STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
+ STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
+ STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
+ STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
+ STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
+ STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
+ STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
+ STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
+
__ push(receiver()); // receiver
- // Push data from ExecutableAccessorInfo.
+ // Push data from AccessorInfo.
Handle<Object> data(callback->data(), isolate());
if (data->IsUndefined() || data->IsSmi()) {
__ push(Immediate(data));
} else {
- DCHECK(!scratch2().is(reg));
Handle<WeakCell> cell =
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
// The callback is alive if this instruction is executed,
@@ -623,13 +626,9 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
__ push(Immediate(isolate()->factory()->undefined_value()));
__ push(Immediate(reinterpret_cast<int>(isolate())));
__ push(reg); // holder
-
- // Save a pointer to where we pushed the arguments. This will be
- // passed as the const PropertyAccessorInfo& to the C++ callback.
- __ push(esp);
+ __ push(Immediate(Smi::FromInt(0))); // should_throw_on_error -> false
__ push(name()); // name
-
__ push(scratch3()); // Restore return address.
// Abi for CallApiGetter
@@ -731,8 +730,8 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
- Handle<JSObject> object, Handle<Name> name,
- Handle<ExecutableAccessorInfo> callback) {
+ Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback,
+ LanguageMode language_mode) {
Register holder_reg = Frontend(name);
__ pop(scratch1()); // remove the return address
@@ -748,6 +747,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
}
__ Push(name);
__ push(value());
+ __ push(Immediate(Smi::FromInt(language_mode)));
__ push(scratch1()); // restore return address
// Do tail-call to the runtime system.
@@ -802,7 +802,7 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
}
Counters* counters = isolate()->counters();
- __ IncrementCounter(counters->named_load_global_stub(), 1);
+ __ IncrementCounter(counters->ic_named_load_global_stub(), 1);
// The code above already loads the result into the return register.
if (IC::ICUseVector(kind())) {
DiscardVectorAndSlot();
diff --git a/src/ic/x87/ic-x87.cc b/src/ic/x87/ic-x87.cc
index d4cc3ce8..5bbd9c58 100644
--- a/src/ic/x87/ic-x87.cc
+++ b/src/ic/x87/ic-x87.cc
@@ -167,7 +167,7 @@ static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm,
static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver,
Register key, Register scratch,
Register scratch2, Register result,
- Label* slow, LanguageMode language_mode) {
+ Label* slow) {
// Register use:
// receiver - holds the receiver and is unchanged.
// key - holds the key and is unchanged (must be a smi).
@@ -211,13 +211,8 @@ static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver,
__ jmp(&check_next_prototype);
__ bind(&absent);
- if (is_strong(language_mode)) {
- // Strong mode accesses must throw in this case, so call the runtime.
- __ jmp(slow);
- } else {
- __ mov(result, masm->isolate()->factory()->undefined_value());
- __ jmp(&done);
- }
+ __ mov(result, masm->isolate()->factory()->undefined_value());
+ __ jmp(&done);
__ bind(&in_bounds);
// Fast case: Do the load.
@@ -262,9 +257,7 @@ static void GenerateKeyNameCheck(MacroAssembler* masm, Register key,
__ bind(&unique);
}
-
-void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
- LanguageMode language_mode) {
+void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) {
// The return address is on the stack.
Label slow, check_name, index_smi, index_name, property_array_property;
Label probe_dictionary, check_number_dictionary;
@@ -286,11 +279,10 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
// Check the receiver's map to see if it has fast elements.
__ CheckFastElements(eax, &check_number_dictionary);
- GenerateFastArrayLoad(masm, receiver, key, eax, ebx, eax, &slow,
- language_mode);
+ GenerateFastArrayLoad(masm, receiver, key, eax, ebx, eax, &slow);
Isolate* isolate = masm->isolate();
Counters* counters = isolate->counters();
- __ IncrementCounter(counters->keyed_load_generic_smi(), 1);
+ __ IncrementCounter(counters->ic_keyed_load_generic_smi(), 1);
__ ret(0);
__ bind(&check_number_dictionary);
@@ -318,8 +310,8 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
__ bind(&slow);
// Slow case: jump to runtime.
- __ IncrementCounter(counters->keyed_load_generic_slow(), 1);
- GenerateRuntimeGetProperty(masm, language_mode);
+ __ IncrementCounter(counters->ic_keyed_load_generic_slow(), 1);
+ GenerateRuntimeGetProperty(masm);
__ bind(&check_name);
GenerateKeyNameCheck(masm, key, eax, ebx, &index_name, &slow);
@@ -363,7 +355,7 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
GenerateGlobalInstanceTypeCheck(masm, eax, &slow);
GenerateDictionaryLoad(masm, &slow, ebx, key, eax, edi, eax);
- __ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
+ __ IncrementCounter(counters->ic_keyed_load_generic_symbol(), 1);
__ ret(0);
__ bind(&index_name);
@@ -628,8 +620,7 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
GenerateMiss(masm);
}
-
-void LoadIC::GenerateNormal(MacroAssembler* masm, LanguageMode language_mode) {
+void LoadIC::GenerateNormal(MacroAssembler* masm) {
Register dictionary = eax;
DCHECK(!dictionary.is(LoadDescriptor::ReceiverRegister()));
DCHECK(!dictionary.is(LoadDescriptor::NameRegister()));
@@ -644,7 +635,7 @@ void LoadIC::GenerateNormal(MacroAssembler* masm, LanguageMode language_mode) {
// Dictionary load failed, go slow (but don't miss).
__ bind(&slow);
- GenerateRuntimeGetProperty(masm, language_mode);
+ GenerateRuntimeGetProperty(masm);
}
@@ -668,16 +659,14 @@ static void LoadIC_PushArgs(MacroAssembler* masm) {
void LoadIC::GenerateMiss(MacroAssembler* masm) {
// Return address is on the stack.
- __ IncrementCounter(masm->isolate()->counters()->load_miss(), 1);
+ __ IncrementCounter(masm->isolate()->counters()->ic_load_miss(), 1);
LoadIC_PushArgs(masm);
// Perform tail call to the entry.
__ TailCallRuntime(Runtime::kLoadIC_Miss);
}
-
-void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm,
- LanguageMode language_mode) {
+void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// Return address is on the stack.
Register receiver = LoadDescriptor::ReceiverRegister();
Register name = LoadDescriptor::NameRegister();
@@ -689,14 +678,13 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm,
__ push(ebx);
// Do tail-call to runtime routine.
- __ TailCallRuntime(is_strong(language_mode) ? Runtime::kGetPropertyStrong
- : Runtime::kGetProperty);
+ __ TailCallRuntime(Runtime::kGetProperty);
}
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
// Return address is on the stack.
- __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1);
+ __ IncrementCounter(masm->isolate()->counters()->ic_keyed_load_miss(), 1);
LoadIC_PushArgs(masm);
@@ -704,9 +692,7 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kKeyedLoadIC_Miss);
}
-
-void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm,
- LanguageMode language_mode) {
+void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// Return address is on the stack.
Register receiver = LoadDescriptor::ReceiverRegister();
Register name = LoadDescriptor::NameRegister();
@@ -718,8 +704,7 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm,
__ push(ebx);
// Do tail-call to runtime routine.
- __ TailCallRuntime(is_strong(language_mode) ? Runtime::kKeyedGetPropertyStrong
- : Runtime::kKeyedGetProperty);
+ __ TailCallRuntime(Runtime::kKeyedGetProperty);
}
@@ -777,14 +762,14 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
receiver, edi);
__ Drop(3);
Counters* counters = masm->isolate()->counters();
- __ IncrementCounter(counters->store_normal_hit(), 1);
+ __ IncrementCounter(counters->ic_store_normal_hit(), 1);
__ ret(0);
__ bind(&restore_miss);
__ pop(slot);
__ pop(vector);
__ pop(receiver);
- __ IncrementCounter(counters->store_normal_miss(), 1);
+ __ IncrementCounter(counters->ic_store_normal_miss(), 1);
GenerateMiss(masm);
}