OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2401 break; | 2401 break; |
2402 default: | 2402 default: |
2403 UNREACHABLE(); | 2403 UNREACHABLE(); |
2404 } | 2404 } |
2405 | 2405 |
2406 __ bind(&done); | 2406 __ bind(&done); |
2407 context()->Plug(eax); | 2407 context()->Plug(eax); |
2408 } | 2408 } |
2409 | 2409 |
2410 | 2410 |
| 2411 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
| 2412 // Constructor is in eax. |
| 2413 DCHECK(lit != NULL); |
| 2414 __ push(eax); |
| 2415 |
| 2416 // No access check is needed here since the constructor is created by the |
| 2417 // class literal. |
| 2418 Register scratch = ebx; |
| 2419 __ mov(scratch, FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset)); |
| 2420 __ Push(scratch); |
| 2421 |
| 2422 for (int i = 0; i < lit->properties()->length(); i++) { |
| 2423 ObjectLiteral::Property* property = lit->properties()->at(i); |
| 2424 Literal* key = property->key()->AsLiteral(); |
| 2425 Expression* value = property->value(); |
| 2426 DCHECK(key != NULL); |
| 2427 |
| 2428 if (property->is_static()) { |
| 2429 __ push(Operand(esp, kPointerSize)); // constructor |
| 2430 } else { |
| 2431 __ push(Operand(esp, 0)); // prototype |
| 2432 } |
| 2433 VisitForStackValue(key); |
| 2434 |
| 2435 switch (property->kind()) { |
| 2436 case ObjectLiteral::Property::CONSTANT: |
| 2437 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 2438 case ObjectLiteral::Property::COMPUTED: |
| 2439 case ObjectLiteral::Property::PROTOTYPE: |
| 2440 VisitForStackValue(value); |
| 2441 __ push(Immediate(Smi::FromInt(NONE))); |
| 2442 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); |
| 2443 break; |
| 2444 |
| 2445 case ObjectLiteral::Property::GETTER: |
| 2446 VisitForStackValue(value); |
| 2447 __ push(Immediate(isolate()->factory()->null_value())); |
| 2448 __ push(Immediate(Smi::FromInt(NONE))); |
| 2449 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
| 2450 break; |
| 2451 |
| 2452 case ObjectLiteral::Property::SETTER: |
| 2453 __ push(Immediate(isolate()->factory()->null_value())); |
| 2454 VisitForStackValue(value); |
| 2455 __ push(Immediate(Smi::FromInt(NONE))); |
| 2456 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
| 2457 break; |
| 2458 |
| 2459 default: |
| 2460 UNREACHABLE(); |
| 2461 } |
| 2462 } |
| 2463 |
| 2464 // prototype |
| 2465 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2466 |
| 2467 // constructor |
| 2468 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2469 } |
| 2470 |
| 2471 |
2411 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2472 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
2412 Token::Value op, | 2473 Token::Value op, |
2413 OverwriteMode mode) { | 2474 OverwriteMode mode) { |
2414 __ pop(edx); | 2475 __ pop(edx); |
2415 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); | 2476 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); |
2416 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2477 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2417 CallIC(code, expr->BinaryOperationFeedbackId()); | 2478 CallIC(code, expr->BinaryOperationFeedbackId()); |
2418 patch_site.EmitPatchInfo(); | 2479 patch_site.EmitPatchInfo(); |
2419 context()->Plug(eax); | 2480 context()->Plug(eax); |
2420 } | 2481 } |
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5147 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5208 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5148 Assembler::target_address_at(call_target_address, | 5209 Assembler::target_address_at(call_target_address, |
5149 unoptimized_code)); | 5210 unoptimized_code)); |
5150 return OSR_AFTER_STACK_CHECK; | 5211 return OSR_AFTER_STACK_CHECK; |
5151 } | 5212 } |
5152 | 5213 |
5153 | 5214 |
5154 } } // namespace v8::internal | 5215 } } // namespace v8::internal |
5155 | 5216 |
5156 #endif // V8_TARGET_ARCH_X87 | 5217 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |