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

Side by Side Diff: src/mips64/full-codegen-mips64.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 | « src/mips/full-codegen-mips.cc ('k') | no next file » | 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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 break; 2472 break;
2473 default: 2473 default:
2474 UNREACHABLE(); 2474 UNREACHABLE();
2475 } 2475 }
2476 2476
2477 __ bind(&done); 2477 __ bind(&done);
2478 context()->Plug(v0); 2478 context()->Plug(v0);
2479 } 2479 }
2480 2480
2481 2481
2482 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2483 // Constructor is in v0.
2484 DCHECK(lit != NULL);
2485 __ push(v0);
2486
2487 // No access check is needed here since the constructor is created by the
2488 // class literal.
2489 Register scratch = a1;
2490 __ ld(scratch,
2491 FieldMemOperand(v0, JSFunction::kPrototypeOrInitialMapOffset));
2492 __ push(scratch);
2493
2494 for (int i = 0; i < lit->properties()->length(); i++) {
2495 ObjectLiteral::Property* property = lit->properties()->at(i);
2496 Literal* key = property->key()->AsLiteral();
2497 Expression* value = property->value();
2498 DCHECK(key != NULL);
2499
2500 if (property->is_static()) {
2501 __ ld(scratch, MemOperand(sp, kPointerSize)); // constructor
2502 } else {
2503 __ ld(scratch, MemOperand(sp, 0)); // prototype
2504 }
2505 __ push(scratch);
2506 VisitForStackValue(key);
2507
2508 switch (property->kind()) {
2509 case ObjectLiteral::Property::CONSTANT:
2510 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2511 case ObjectLiteral::Property::COMPUTED:
2512 case ObjectLiteral::Property::PROTOTYPE:
2513 VisitForStackValue(value);
2514 __ li(scratch, Operand(Smi::FromInt(NONE)));
2515 __ push(scratch);
2516 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
2517 break;
2518
2519 case ObjectLiteral::Property::GETTER:
2520 VisitForStackValue(value);
2521 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2522 __ push(scratch);
2523 __ li(scratch, Operand(Smi::FromInt(NONE)));
2524 __ push(scratch);
2525 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2526 break;
2527
2528 case ObjectLiteral::Property::SETTER:
2529 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2530 __ push(scratch);
2531 VisitForStackValue(value);
2532 __ li(scratch, Operand(Smi::FromInt(NONE)));
2533 __ push(scratch);
2534 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2535 break;
2536
2537 default:
2538 UNREACHABLE();
2539 }
2540 }
2541
2542 // prototype
2543 __ CallRuntime(Runtime::kToFastProperties, 1);
2544
2545 // constructor
2546 __ CallRuntime(Runtime::kToFastProperties, 1);
2547 }
2548
2549
2482 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2550 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2483 Token::Value op, 2551 Token::Value op,
2484 OverwriteMode mode) { 2552 OverwriteMode mode) {
2485 __ mov(a0, result_register()); 2553 __ mov(a0, result_register());
2486 __ pop(a1); 2554 __ pop(a1);
2487 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); 2555 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
2488 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2556 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2489 CallIC(code, expr->BinaryOperationFeedbackId()); 2557 CallIC(code, expr->BinaryOperationFeedbackId());
2490 patch_site.EmitPatchInfo(); 2558 patch_site.EmitPatchInfo();
2491 context()->Plug(v0); 2559 context()->Plug(v0);
(...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after
5220 Assembler::target_address_at(pc_immediate_load_address)) == 5288 Assembler::target_address_at(pc_immediate_load_address)) ==
5221 reinterpret_cast<uint64_t>( 5289 reinterpret_cast<uint64_t>(
5222 isolate->builtins()->OsrAfterStackCheck()->entry())); 5290 isolate->builtins()->OsrAfterStackCheck()->entry()));
5223 return OSR_AFTER_STACK_CHECK; 5291 return OSR_AFTER_STACK_CHECK;
5224 } 5292 }
5225 5293
5226 5294
5227 } } // namespace v8::internal 5295 } } // namespace v8::internal
5228 5296
5229 #endif // V8_TARGET_ARCH_MIPS64 5297 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698