Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc
index d7403fa..2fb9961 100644
--- a/src/full-codegen/x87/full-codegen-x87.cc
+++ b/src/full-codegen/x87/full-codegen-x87.cc
@@ -487,10 +487,12 @@
true,
true_label_,
false_label_);
- DCHECK(lit->IsNull() || lit->IsUndefined() || !lit->IsUndetectable());
- if (lit->IsUndefined() || lit->IsNull() || lit->IsFalse()) {
+ DCHECK(lit->IsNull(isolate()) || lit->IsUndefined(isolate()) ||
+ !lit->IsUndetectable());
+ if (lit->IsUndefined(isolate()) || lit->IsNull(isolate()) ||
+ lit->IsFalse(isolate())) {
if (false_label_ != fall_through_) __ jmp(false_label_);
- } else if (lit->IsTrue() || lit->IsJSObject()) {
+ } else if (lit->IsTrue(isolate()) || lit->IsJSObject()) {
if (true_label_ != fall_through_) __ jmp(true_label_);
} else if (lit->IsString()) {
if (String::cast(*lit)->length() == 0) {
@@ -743,21 +745,10 @@
case VariableLocation::LOOKUP: {
Comment cmnt(masm_, "[ VariableDeclaration");
+ DCHECK_EQ(VAR, mode);
+ DCHECK(!hole_init);
__ push(Immediate(variable->name()));
- // VariableDeclaration nodes are always introduced in one of four modes.
- DCHECK(IsDeclaredVariableMode(mode));
- // Push initial value, if any.
- // Note: For variables we must not push an initial value (such as
- // 'undefined') because we may have a (legal) redeclaration and we
- // must not destroy the current value.
- if (hole_init) {
- __ push(Immediate(isolate()->factory()->the_hole_value()));
- } else {
- __ push(Immediate(Smi::FromInt(0))); // Indicates no initial value.
- }
- __ push(
- Immediate(Smi::FromInt(variable->DeclarationPropertyAttributes())));
- __ CallRuntime(Runtime::kDeclareLookupSlot);
+ __ CallRuntime(Runtime::kDeclareEvalVar);
PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS);
break;
}
@@ -805,8 +796,7 @@
Comment cmnt(masm_, "[ FunctionDeclaration");
PushOperand(variable->name());
VisitForStackValue(declaration->fun());
- PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes()));
- CallRuntimeWithOperands(Runtime::kDeclareLookupSlot);
+ CallRuntimeWithOperands(Runtime::kDeclareEvalFunction);
PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS);
break;
}
@@ -1218,17 +1208,14 @@
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
+#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocatedOrGlobalSlot() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
- __ mov(LoadDescriptor::ReceiverRegister(), NativeContextOperand());
- __ mov(LoadDescriptor::ReceiverRegister(),
- ContextOperand(LoadDescriptor::ReceiverRegister(),
- Context::EXTENSION_INDEX));
- __ mov(LoadDescriptor::NameRegister(), var->name());
- __ mov(LoadDescriptor::SlotRegister(),
+#endif
+ __ mov(LoadGlobalDescriptor::SlotRegister(),
Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
- CallLoadIC(typeof_mode);
+ CallLoadGlobalIC(typeof_mode);
}
@@ -1297,18 +1284,6 @@
}
-void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
- Comment cmnt(masm_, "[ RegExpLiteral");
- __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
- __ Move(eax, Immediate(Smi::FromInt(expr->literal_index())));
- __ Move(ecx, Immediate(expr->pattern()));
- __ Move(edx, Immediate(Smi::FromInt(expr->flags())));
- FastCloneRegExpStub stub(isolate());
- __ CallStub(&stub);
- context()->Plug(eax);
-}
-
-
void FullCodeGenerator::EmitAccessor(ObjectLiteralProperty* property) {
Expression* expression = (property == NULL) ? NULL : property->value();
if (expression == NULL) {
@@ -1415,12 +1390,16 @@
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
- accessor_table.lookup(key)->second->getter = property;
+ AccessorTable::Iterator it = accessor_table.lookup(key);
+ it->second->bailout_id = expr->GetIdForPropertySet(property_index);
+ it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
- accessor_table.lookup(key)->second->setter = property;
+ AccessorTable::Iterator it = accessor_table.lookup(key);
+ it->second->bailout_id = expr->GetIdForPropertySet(property_index);
+ it->second->setter = property;
}
break;
}
@@ -1439,6 +1418,7 @@
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineAccessorPropertyUnchecked);
+ PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
@@ -1483,6 +1463,8 @@
PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
+ PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
+ BailoutState::NO_REGISTERS);
} else {
DropOperands(3);
}
@@ -1758,7 +1740,7 @@
// When we arrive here, eax holds the generator object.
__ RecordGeneratorContinuation();
__ mov(ebx, FieldOperand(eax, JSGeneratorObject::kResumeModeOffset));
- __ mov(eax, FieldOperand(eax, JSGeneratorObject::kInputOffset));
+ __ mov(eax, FieldOperand(eax, JSGeneratorObject::kInputOrDebugPosOffset));
STATIC_ASSERT(JSGeneratorObject::kNext < JSGeneratorObject::kReturn);
STATIC_ASSERT(JSGeneratorObject::kThrow > JSGeneratorObject::kReturn);
__ cmp(ebx, Immediate(Smi::FromInt(JSGeneratorObject::kReturn)));
@@ -2783,75 +2765,6 @@
}
-void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
- ZoneList<Expression*>* args = expr->arguments();
- DCHECK_EQ(3, args->length());
-
- Register string = eax;
- Register index = ebx;
- Register value = ecx;
-
- VisitForStackValue(args->at(0)); // index
- VisitForStackValue(args->at(1)); // value
- VisitForAccumulatorValue(args->at(2)); // string
-
- PopOperand(value);
- PopOperand(index);
-
- if (FLAG_debug_code) {
- __ test(value, Immediate(kSmiTagMask));
- __ Check(zero, kNonSmiValue);
- __ test(index, Immediate(kSmiTagMask));
- __ Check(zero, kNonSmiValue);
- }
-
- __ SmiUntag(value);
- __ SmiUntag(index);
-
- if (FLAG_debug_code) {
- static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
- __ EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type);
- }
-
- __ mov_b(FieldOperand(string, index, times_1, SeqOneByteString::kHeaderSize),
- value);
- context()->Plug(string);
-}
-
-
-void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) {
- ZoneList<Expression*>* args = expr->arguments();
- DCHECK_EQ(3, args->length());
-
- Register string = eax;
- Register index = ebx;
- Register value = ecx;
-
- VisitForStackValue(args->at(0)); // index
- VisitForStackValue(args->at(1)); // value
- VisitForAccumulatorValue(args->at(2)); // string
- PopOperand(value);
- PopOperand(index);
-
- if (FLAG_debug_code) {
- __ test(value, Immediate(kSmiTagMask));
- __ Check(zero, kNonSmiValue);
- __ test(index, Immediate(kSmiTagMask));
- __ Check(zero, kNonSmiValue);
- __ SmiUntag(index);
- static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
- __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type);
- __ SmiTag(index);
- }
-
- __ SmiUntag(value);
- // No need to untag a smi for two-byte addressing.
- __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize),
- value);
- context()->Plug(string);
-}
-
-
void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);
@@ -2887,13 +2800,8 @@
Label need_conversion;
Label index_out_of_range;
Label done;
- StringCharCodeAtGenerator generator(object,
- index,
- result,
- &need_conversion,
- &need_conversion,
- &index_out_of_range,
- STRING_INDEX_IS_NUMBER);
+ StringCharCodeAtGenerator generator(object, index, result, &need_conversion,
+ &need_conversion, &index_out_of_range);
generator.GenerateFast(masm_);
__ jmp(&done);
@@ -2917,54 +2825,6 @@
}
-void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) {
- ZoneList<Expression*>* args = expr->arguments();
- DCHECK(args->length() == 2);
-
- VisitForStackValue(args->at(0));
- VisitForAccumulatorValue(args->at(1));
-
- Register object = ebx;
- Register index = eax;
- Register scratch = edx;
- Register result = eax;
-
- PopOperand(object);
-
- Label need_conversion;
- Label index_out_of_range;
- Label done;
- StringCharAtGenerator generator(object,
- index,
- scratch,
- result,
- &need_conversion,
- &need_conversion,
- &index_out_of_range,
- STRING_INDEX_IS_NUMBER);
- generator.GenerateFast(masm_);
- __ jmp(&done);
-
- __ bind(&index_out_of_range);
- // When the index is out of range, the spec requires us to return
- // the empty string.
- __ Move(result, Immediate(isolate()->factory()->empty_string()));
- __ jmp(&done);
-
- __ bind(&need_conversion);
- // Move smi zero into the result register, which will trigger
- // conversion.
- __ Move(result, Immediate(Smi::FromInt(0)));
- __ jmp(&done);
-
- NopRuntimeCallHelper call_helper;
- generator.GenerateSlow(masm_, NOT_PART_OF_IC_HANDLER, call_helper);
-
- __ bind(&done);
- context()->Plug(result);
-}
-
-
void FullCodeGenerator::EmitCall(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_LE(2, args->length());
@@ -3343,8 +3203,7 @@
}
// Convert old value into a number.
- ToNumberStub convert_stub(isolate());
- __ CallStub(&convert_stub);
+ __ Call(isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
PrepareForBailoutForId(expr->ToNumberId(), BailoutState::TOS_REGISTER);
// Save result for postfix expressions.