OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2290 Label smi_case, done, stub_call; | 2290 Label smi_case, done, stub_call; |
2291 __ pop(edx); | 2291 __ pop(edx); |
2292 __ mov(ecx, eax); | 2292 __ mov(ecx, eax); |
2293 __ or_(eax, edx); | 2293 __ or_(eax, edx); |
2294 JumpPatchSite patch_site(masm_); | 2294 JumpPatchSite patch_site(masm_); |
2295 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); | 2295 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); |
2296 | 2296 |
2297 __ bind(&stub_call); | 2297 __ bind(&stub_call); |
2298 __ mov(eax, ecx); | 2298 __ mov(eax, ecx); |
2299 BinaryOpICStub stub(isolate(), op, mode); | 2299 BinaryOpICStub stub(isolate(), op, mode); |
2300 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); | 2300 CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId()); |
2301 patch_site.EmitPatchInfo(); | 2301 patch_site.EmitPatchInfo(); |
2302 __ jmp(&done, Label::kNear); | 2302 __ jmp(&done, Label::kNear); |
2303 | 2303 |
2304 // Smi case. | 2304 // Smi case. |
2305 __ bind(&smi_case); | 2305 __ bind(&smi_case); |
2306 __ mov(eax, edx); // Copy left operand in case of a stub call. | 2306 __ mov(eax, edx); // Copy left operand in case of a stub call. |
2307 | 2307 |
2308 switch (op) { | 2308 switch (op) { |
2309 case Token::SAR: | 2309 case Token::SAR: |
2310 __ SmiUntag(ecx); | 2310 __ SmiUntag(ecx); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 context()->Plug(eax); | 2374 context()->Plug(eax); |
2375 } | 2375 } |
2376 | 2376 |
2377 | 2377 |
2378 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2378 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
2379 Token::Value op, | 2379 Token::Value op, |
2380 OverwriteMode mode) { | 2380 OverwriteMode mode) { |
2381 __ pop(edx); | 2381 __ pop(edx); |
2382 BinaryOpICStub stub(isolate(), op, mode); | 2382 BinaryOpICStub stub(isolate(), op, mode); |
2383 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2383 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2384 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); | 2384 CallIC(stub.GetCode(), expr->BinaryOperationFeedbackId()); |
2385 patch_site.EmitPatchInfo(); | 2385 patch_site.EmitPatchInfo(); |
2386 context()->Plug(eax); | 2386 context()->Plug(eax); |
2387 } | 2387 } |
2388 | 2388 |
2389 | 2389 |
2390 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2390 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
2391 ASSERT(expr->IsValidReferenceExpression()); | 2391 ASSERT(expr->IsValidReferenceExpression()); |
2392 | 2392 |
2393 // Left-hand side can only be a property, a global or a (parameter or local) | 2393 // Left-hand side can only be a property, a global or a (parameter or local) |
2394 // slot. | 2394 // slot. |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2882 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(), | 2882 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(), |
2883 isolate()->factory()->NewAllocationSite()); | 2883 isolate()->factory()->NewAllocationSite()); |
2884 ASSERT(expr->AllocationSiteFeedbackSlot() == | 2884 ASSERT(expr->AllocationSiteFeedbackSlot() == |
2885 expr->CallNewFeedbackSlot() + 1); | 2885 expr->CallNewFeedbackSlot() + 1); |
2886 } | 2886 } |
2887 | 2887 |
2888 __ LoadHeapObject(ebx, FeedbackVector()); | 2888 __ LoadHeapObject(ebx, FeedbackVector()); |
2889 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); | 2889 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); |
2890 | 2890 |
2891 CallConstructStub stub(isolate(), RECORD_CALL_TARGET); | 2891 CallConstructStub stub(isolate(), RECORD_CALL_TARGET); |
2892 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2892 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
2893 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2893 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2894 context()->Plug(eax); | 2894 context()->Plug(eax); |
2895 } | 2895 } |
2896 | 2896 |
2897 | 2897 |
2898 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2898 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2899 ZoneList<Expression*>* args = expr->arguments(); | 2899 ZoneList<Expression*>* args = expr->arguments(); |
2900 ASSERT(args->length() == 1); | 2900 ASSERT(args->length() == 1); |
2901 | 2901 |
2902 VisitForAccumulatorValue(args->at(0)); | 2902 VisitForAccumulatorValue(args->at(0)); |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4419 } | 4419 } |
4420 | 4420 |
4421 // Record position before stub call. | 4421 // Record position before stub call. |
4422 SetSourcePosition(expr->position()); | 4422 SetSourcePosition(expr->position()); |
4423 | 4423 |
4424 // Call stub for +1/-1. | 4424 // Call stub for +1/-1. |
4425 __ bind(&stub_call); | 4425 __ bind(&stub_call); |
4426 __ mov(edx, eax); | 4426 __ mov(edx, eax); |
4427 __ mov(eax, Immediate(Smi::FromInt(1))); | 4427 __ mov(eax, Immediate(Smi::FromInt(1))); |
4428 BinaryOpICStub stub(isolate(), expr->binary_op(), NO_OVERWRITE); | 4428 BinaryOpICStub stub(isolate(), expr->binary_op(), NO_OVERWRITE); |
4429 CallIC(stub.GetCode(isolate()), expr->CountBinOpFeedbackId()); | 4429 CallIC(stub.GetCode(), expr->CountBinOpFeedbackId()); |
4430 patch_site.EmitPatchInfo(); | 4430 patch_site.EmitPatchInfo(); |
4431 __ bind(&done); | 4431 __ bind(&done); |
4432 | 4432 |
4433 // Store the value returned in eax. | 4433 // Store the value returned in eax. |
4434 switch (assign_type) { | 4434 switch (assign_type) { |
4435 case VARIABLE: | 4435 case VARIABLE: |
4436 if (expr->is_postfix()) { | 4436 if (expr->is_postfix()) { |
4437 // Perform the assignment as if via '='. | 4437 // Perform the assignment as if via '='. |
4438 { EffectContext context(this); | 4438 { EffectContext context(this); |
4439 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4439 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4925 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4925 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4926 Assembler::target_address_at(call_target_address, | 4926 Assembler::target_address_at(call_target_address, |
4927 unoptimized_code)); | 4927 unoptimized_code)); |
4928 return OSR_AFTER_STACK_CHECK; | 4928 return OSR_AFTER_STACK_CHECK; |
4929 } | 4929 } |
4930 | 4930 |
4931 | 4931 |
4932 } } // namespace v8::internal | 4932 } } // namespace v8::internal |
4933 | 4933 |
4934 #endif // V8_TARGET_ARCH_IA32 | 4934 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |