| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index 09f5de1f10a239ac32e3a42c14b1b8a02cff8d89..f3ac9c5cbafebc73ed2d57a583930d749559fcb2 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -1574,6 +1574,9 @@ void FullCodeGenerator::EmitAccessor(Expression* expression) {
|
|
|
| void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| Comment cmnt(masm_, "[ ObjectLiteral");
|
| +
|
| + int depth = 1;
|
| + expr->BuildConstantProperties(isolate(), &depth);
|
| Handle<FixedArray> constant_properties = expr->constant_properties();
|
| int flags = expr->fast_elements()
|
| ? ObjectLiteral::kFastElements
|
| @@ -1583,7 +1586,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| : ObjectLiteral::kNoFlags;
|
| int properties_count = constant_properties->length() / 2;
|
| if ((FLAG_track_double_fields && expr->may_store_doubles()) ||
|
| - expr->depth() > 1 || Serializer::enabled() ||
|
| + depth > 1 || Serializer::enabled() ||
|
| flags != ObjectLiteral::kFastElements ||
|
| properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
|
| __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
|
| @@ -1702,6 +1705,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
| Comment cmnt(masm_, "[ ArrayLiteral");
|
|
|
| + int depth = 1;
|
| + expr->BuildConstantElements(isolate(), &depth);
|
| ZoneList<Expression*>* subexprs = expr->values();
|
| int length = subexprs->length();
|
| Handle<FixedArray> constant_elements = expr->constant_elements();
|
| @@ -1728,8 +1733,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
| DONT_TRACK_ALLOCATION_SITE,
|
| length);
|
| __ CallStub(&stub);
|
| - } else if (expr->depth() > 1 ||
|
| - Serializer::enabled() ||
|
| + } else if (depth > 1 || Serializer::enabled() ||
|
| length > FastCloneShallowArrayStub::kMaximumClonedLength) {
|
| __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
|
| __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
|
| @@ -3667,11 +3671,20 @@ void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) {
|
| ZoneList<Expression*>* args = expr->arguments();
|
| ASSERT_EQ(2, args->length());
|
|
|
| - VisitForStackValue(args->at(0));
|
| - VisitForStackValue(args->at(1));
|
| + if (FLAG_new_string_add) {
|
| + VisitForStackValue(args->at(0));
|
| + VisitForAccumulatorValue(args->at(1));
|
|
|
| - StringAddStub stub(STRING_ADD_CHECK_BOTH);
|
| - __ CallStub(&stub);
|
| + __ pop(edx);
|
| + NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED);
|
| + __ CallStub(&stub);
|
| + } else {
|
| + VisitForStackValue(args->at(0));
|
| + VisitForStackValue(args->at(1));
|
| +
|
| + StringAddStub stub(STRING_ADD_CHECK_BOTH);
|
| + __ CallStub(&stub);
|
| + }
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -4394,14 +4407,50 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| PrepareForBailoutForId(prop->LoadId(), TOS_REG);
|
| }
|
|
|
| - // Call ToNumber only if operand is not a smi.
|
| - Label no_conversion;
|
| + // Inline smi case if we are in a loop.
|
| + Label done, stub_call;
|
| + JumpPatchSite patch_site(masm_);
|
| if (ShouldInlineSmiCase(expr->op())) {
|
| - __ JumpIfSmi(eax, &no_conversion, Label::kNear);
|
| + Label slow;
|
| + patch_site.EmitJumpIfNotSmi(eax, &slow, Label::kNear);
|
| +
|
| + // Save result for postfix expressions.
|
| + if (expr->is_postfix()) {
|
| + if (!context()->IsEffect()) {
|
| + // Save the result on the stack. If we have a named or keyed property
|
| + // we store the result under the receiver that is currently on top
|
| + // of the stack.
|
| + switch (assign_type) {
|
| + case VARIABLE:
|
| + __ push(eax);
|
| + break;
|
| + case NAMED_PROPERTY:
|
| + __ mov(Operand(esp, kPointerSize), eax);
|
| + break;
|
| + case KEYED_PROPERTY:
|
| + __ mov(Operand(esp, 2 * kPointerSize), eax);
|
| + break;
|
| + }
|
| + }
|
| + }
|
| +
|
| + if (expr->op() == Token::INC) {
|
| + __ add(eax, Immediate(Smi::FromInt(1)));
|
| + } else {
|
| + __ sub(eax, Immediate(Smi::FromInt(1)));
|
| + }
|
| + __ j(no_overflow, &done, Label::kNear);
|
| + // Call stub. Undo operation first.
|
| + if (expr->op() == Token::INC) {
|
| + __ sub(eax, Immediate(Smi::FromInt(1)));
|
| + } else {
|
| + __ add(eax, Immediate(Smi::FromInt(1)));
|
| + }
|
| + __ jmp(&stub_call, Label::kNear);
|
| + __ bind(&slow);
|
| }
|
| ToNumberStub convert_stub;
|
| __ CallStub(&convert_stub);
|
| - __ bind(&no_conversion);
|
|
|
| // Save result for postfix expressions.
|
| if (expr->is_postfix()) {
|
| @@ -4423,34 +4472,11 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| }
|
| }
|
|
|
| - // Inline smi case if we are in a loop.
|
| - Label done, stub_call;
|
| - JumpPatchSite patch_site(masm_);
|
| -
|
| - if (ShouldInlineSmiCase(expr->op())) {
|
| - if (expr->op() == Token::INC) {
|
| - __ add(eax, Immediate(Smi::FromInt(1)));
|
| - } else {
|
| - __ sub(eax, Immediate(Smi::FromInt(1)));
|
| - }
|
| - __ j(overflow, &stub_call, Label::kNear);
|
| - // We could eliminate this smi check if we split the code at
|
| - // the first smi check before calling ToNumber.
|
| - patch_site.EmitJumpIfSmi(eax, &done, Label::kNear);
|
| -
|
| - __ bind(&stub_call);
|
| - // Call stub. Undo operation first.
|
| - if (expr->op() == Token::INC) {
|
| - __ sub(eax, Immediate(Smi::FromInt(1)));
|
| - } else {
|
| - __ add(eax, Immediate(Smi::FromInt(1)));
|
| - }
|
| - }
|
| -
|
| // Record position before stub call.
|
| SetSourcePosition(expr->position());
|
|
|
| // Call stub for +1/-1.
|
| + __ bind(&stub_call);
|
| __ mov(edx, eax);
|
| __ mov(eax, Immediate(Smi::FromInt(1)));
|
| BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE);
|
|
|