Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 687633002: MIPS: Classes: Add basic support for properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 break; 2475 break;
2476 default: 2476 default:
2477 UNREACHABLE(); 2477 UNREACHABLE();
2478 } 2478 }
2479 2479
2480 __ bind(&done); 2480 __ bind(&done);
2481 context()->Plug(v0); 2481 context()->Plug(v0);
2482 } 2482 }
2483 2483
2484 2484
2485 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2486 // Constructor is in v0.
2487 DCHECK(lit != NULL);
2488 __ push(v0);
2489
2490 // No access check is needed here since the constructor is created by the
2491 // class literal.
2492 Register scratch = a1;
2493 __ lw(scratch,
2494 FieldMemOperand(v0, JSFunction::kPrototypeOrInitialMapOffset));
2495 __ push(scratch);
2496
2497 for (int i = 0; i < lit->properties()->length(); i++) {
2498 ObjectLiteral::Property* property = lit->properties()->at(i);
2499 Literal* key = property->key()->AsLiteral();
2500 Expression* value = property->value();
2501 DCHECK(key != NULL);
2502
2503 if (property->is_static()) {
2504 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor
2505 } else {
2506 __ lw(scratch, MemOperand(sp, 0)); // prototype
2507 }
2508 __ push(scratch);
2509 VisitForStackValue(key);
2510
2511 switch (property->kind()) {
2512 case ObjectLiteral::Property::CONSTANT:
2513 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2514 case ObjectLiteral::Property::COMPUTED:
2515 case ObjectLiteral::Property::PROTOTYPE:
2516 VisitForStackValue(value);
2517 __ li(scratch, Operand(Smi::FromInt(NONE)));
2518 __ push(scratch);
2519 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
2520 break;
2521
2522 case ObjectLiteral::Property::GETTER:
2523 VisitForStackValue(value);
2524 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2525 __ push(scratch);
2526 __ li(scratch, Operand(Smi::FromInt(NONE)));
2527 __ push(scratch);
2528 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2529 break;
2530
2531 case ObjectLiteral::Property::SETTER:
2532 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2533 __ push(scratch);
2534 VisitForStackValue(value);
2535 __ li(scratch, Operand(Smi::FromInt(NONE)));
2536 __ push(scratch);
2537 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2538 break;
2539
2540 default:
2541 UNREACHABLE();
2542 }
2543 }
2544
2545 // prototype
2546 __ CallRuntime(Runtime::kToFastProperties, 1);
2547
2548 // constructor
2549 __ CallRuntime(Runtime::kToFastProperties, 1);
2550 }
2551
2552
2485 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2553 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2486 Token::Value op, 2554 Token::Value op,
2487 OverwriteMode mode) { 2555 OverwriteMode mode) {
2488 __ mov(a0, result_register()); 2556 __ mov(a0, result_register());
2489 __ pop(a1); 2557 __ pop(a1);
2490 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); 2558 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
2491 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2559 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2492 CallIC(code, expr->BinaryOperationFeedbackId()); 2560 CallIC(code, expr->BinaryOperationFeedbackId());
2493 patch_site.EmitPatchInfo(); 2561 patch_site.EmitPatchInfo();
2494 context()->Plug(v0); 2562 context()->Plug(v0);
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after
5216 Assembler::target_address_at(pc_immediate_load_address)) == 5284 Assembler::target_address_at(pc_immediate_load_address)) ==
5217 reinterpret_cast<uint32_t>( 5285 reinterpret_cast<uint32_t>(
5218 isolate->builtins()->OsrAfterStackCheck()->entry())); 5286 isolate->builtins()->OsrAfterStackCheck()->entry()));
5219 return OSR_AFTER_STACK_CHECK; 5287 return OSR_AFTER_STACK_CHECK;
5220 } 5288 }
5221 5289
5222 5290
5223 } } // namespace v8::internal 5291 } } // namespace v8::internal
5224 5292
5225 #endif // V8_TARGET_ARCH_MIPS 5293 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698