| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 if (scope()->is_function_scope() && scope()->function() != NULL) { | 227 if (scope()->is_function_scope() && scope()->function() != NULL) { |
| 228 EmitDeclaration(scope()->function(), Variable::CONST, NULL); | 228 EmitDeclaration(scope()->function(), Variable::CONST, NULL); |
| 229 } | 229 } |
| 230 VisitDeclarations(scope()->declarations()); | 230 VisitDeclarations(scope()->declarations()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 { Comment cmnt(masm_, "[ Stack check"); | 233 { Comment cmnt(masm_, "[ Stack check"); |
| 234 PrepareForBailout(info->function(), NO_REGISTERS); | 234 PrepareForBailout(info->function(), NO_REGISTERS); |
| 235 NearLabel ok; | 235 NearLabel ok; |
| 236 ExternalReference stack_limit = | 236 ExternalReference stack_limit = |
| 237 ExternalReference::address_of_stack_limit(); | 237 ExternalReference::address_of_stack_limit(isolate()); |
| 238 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 238 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 239 __ j(above_equal, &ok, taken); | 239 __ j(above_equal, &ok, taken); |
| 240 StackCheckStub stub; | 240 StackCheckStub stub; |
| 241 __ CallStub(&stub); | 241 __ CallStub(&stub); |
| 242 __ bind(&ok); | 242 __ bind(&ok); |
| 243 } | 243 } |
| 244 | 244 |
| 245 { Comment cmnt(masm_, "[ Body"); | 245 { Comment cmnt(masm_, "[ Body"); |
| 246 ASSERT(loop_depth() == 0); | 246 ASSERT(loop_depth() == 0); |
| 247 VisitStatements(function()->body()); | 247 VisitStatements(function()->body()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 259 | 259 |
| 260 | 260 |
| 261 void FullCodeGenerator::ClearAccumulator() { | 261 void FullCodeGenerator::ClearAccumulator() { |
| 262 __ Set(eax, Immediate(Smi::FromInt(0))); | 262 __ Set(eax, Immediate(Smi::FromInt(0))); |
| 263 } | 263 } |
| 264 | 264 |
| 265 | 265 |
| 266 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { | 266 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { |
| 267 Comment cmnt(masm_, "[ Stack check"); | 267 Comment cmnt(masm_, "[ Stack check"); |
| 268 NearLabel ok; | 268 NearLabel ok; |
| 269 ExternalReference stack_limit = ExternalReference::address_of_stack_limit(); | 269 ExternalReference stack_limit = |
| 270 ExternalReference::address_of_stack_limit(isolate()); |
| 270 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 271 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 271 __ j(above_equal, &ok, taken); | 272 __ j(above_equal, &ok, taken); |
| 272 StackCheckStub stub; | 273 StackCheckStub stub; |
| 273 __ CallStub(&stub); | 274 __ CallStub(&stub); |
| 274 // Record a mapping of this PC offset to the OSR id. This is used to find | 275 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 275 // the AST id from the unoptimized code in order to use it as a key into | 276 // the AST id from the unoptimized code in order to use it as a key into |
| 276 // the deoptimization input data found in the optimized code. | 277 // the deoptimization input data found in the optimized code. |
| 277 RecordStackCheck(stmt->OsrEntryId()); | 278 RecordStackCheck(stmt->OsrEntryId()); |
| 278 | 279 |
| 279 // Loop stack checks can be patched to perform on-stack replacement. In | 280 // Loop stack checks can be patched to perform on-stack replacement. In |
| (...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2716 __ jmp(&heapnumber_allocated); | 2717 __ jmp(&heapnumber_allocated); |
| 2717 | 2718 |
| 2718 __ bind(&slow_allocate_heapnumber); | 2719 __ bind(&slow_allocate_heapnumber); |
| 2719 // Allocate a heap number. | 2720 // Allocate a heap number. |
| 2720 __ CallRuntime(Runtime::kNumberAlloc, 0); | 2721 __ CallRuntime(Runtime::kNumberAlloc, 0); |
| 2721 __ mov(edi, eax); | 2722 __ mov(edi, eax); |
| 2722 | 2723 |
| 2723 __ bind(&heapnumber_allocated); | 2724 __ bind(&heapnumber_allocated); |
| 2724 | 2725 |
| 2725 __ PrepareCallCFunction(0, ebx); | 2726 __ PrepareCallCFunction(0, ebx); |
| 2726 __ CallCFunction(ExternalReference::random_uint32_function(), 0); | 2727 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), |
| 2728 0); |
| 2727 | 2729 |
| 2728 // Convert 32 random bits in eax to 0.(32 random bits) in a double | 2730 // Convert 32 random bits in eax to 0.(32 random bits) in a double |
| 2729 // by computing: | 2731 // by computing: |
| 2730 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2732 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 2731 // This is implemented on both SSE2 and FPU. | 2733 // This is implemented on both SSE2 and FPU. |
| 2732 if (isolate()->cpu_features()->IsSupported(SSE2)) { | 2734 if (isolate()->cpu_features()->IsSupported(SSE2)) { |
| 2733 CpuFeatures::Scope fscope(SSE2); | 2735 CpuFeatures::Scope fscope(SSE2); |
| 2734 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 2736 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
| 2735 __ movd(xmm1, Operand(ebx)); | 2737 __ movd(xmm1, Operand(ebx)); |
| 2736 __ movd(xmm0, Operand(eax)); | 2738 __ movd(xmm0, Operand(eax)); |
| (...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4290 // And return. | 4292 // And return. |
| 4291 __ ret(0); | 4293 __ ret(0); |
| 4292 } | 4294 } |
| 4293 | 4295 |
| 4294 | 4296 |
| 4295 #undef __ | 4297 #undef __ |
| 4296 | 4298 |
| 4297 } } // namespace v8::internal | 4299 } } // namespace v8::internal |
| 4298 | 4300 |
| 4299 #endif // V8_TARGET_ARCH_IA32 | 4301 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |