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 6581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6592 VariableProxy* proxy = expr->obj()->AsVariableProxy(); | 6592 VariableProxy* proxy = expr->obj()->AsVariableProxy(); |
6593 if (proxy == NULL) return false; | 6593 if (proxy == NULL) return false; |
6594 if (!proxy->var()->IsStackAllocated()) return false; | 6594 if (!proxy->var()->IsStackAllocated()) return false; |
6595 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) { | 6595 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) { |
6596 return false; | 6596 return false; |
6597 } | 6597 } |
6598 | 6598 |
6599 HInstruction* result = NULL; | 6599 HInstruction* result = NULL; |
6600 if (expr->key()->IsPropertyName()) { | 6600 if (expr->key()->IsPropertyName()) { |
6601 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); | 6601 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); |
6602 if (!name->IsEqualTo(CStrVector("length"))) return false; | 6602 if (!name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("length"))) return false; |
6603 | 6603 |
6604 if (function_state()->outer() == NULL) { | 6604 if (function_state()->outer() == NULL) { |
6605 HInstruction* elements = AddInstruction( | 6605 HInstruction* elements = AddInstruction( |
6606 new(zone()) HArgumentsElements(false)); | 6606 new(zone()) HArgumentsElements(false)); |
6607 result = new(zone()) HArgumentsLength(elements); | 6607 result = new(zone()) HArgumentsLength(elements); |
6608 } else { | 6608 } else { |
6609 // Number of arguments without receiver. | 6609 // Number of arguments without receiver. |
6610 int argument_count = environment()-> | 6610 int argument_count = environment()-> |
6611 arguments_environment()->parameter_count() - 1; | 6611 arguments_environment()->parameter_count() - 1; |
6612 result = new(zone()) HConstant( | 6612 result = new(zone()) HConstant( |
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8488 | 8488 |
8489 | 8489 |
8490 // Check for the form (%_ClassOf(foo) === 'BarClass'). | 8490 // Check for the form (%_ClassOf(foo) === 'BarClass'). |
8491 static bool IsClassOfTest(CompareOperation* expr) { | 8491 static bool IsClassOfTest(CompareOperation* expr) { |
8492 if (expr->op() != Token::EQ_STRICT) return false; | 8492 if (expr->op() != Token::EQ_STRICT) return false; |
8493 CallRuntime* call = expr->left()->AsCallRuntime(); | 8493 CallRuntime* call = expr->left()->AsCallRuntime(); |
8494 if (call == NULL) return false; | 8494 if (call == NULL) return false; |
8495 Literal* literal = expr->right()->AsLiteral(); | 8495 Literal* literal = expr->right()->AsLiteral(); |
8496 if (literal == NULL) return false; | 8496 if (literal == NULL) return false; |
8497 if (!literal->handle()->IsString()) return false; | 8497 if (!literal->handle()->IsString()) return false; |
8498 if (!call->name()->IsEqualTo(CStrVector("_ClassOf"))) return false; | 8498 if (!call->name()->IsOneByteEqualTo(STATIC_ASCII_VECTOR("_ClassOf"))) { |
| 8499 return false; |
| 8500 } |
8499 ASSERT(call->arguments()->length() == 1); | 8501 ASSERT(call->arguments()->length() == 1); |
8500 return true; | 8502 return true; |
8501 } | 8503 } |
8502 | 8504 |
8503 | 8505 |
8504 void HOptimizedGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { | 8506 void HOptimizedGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { |
8505 ASSERT(!HasStackOverflow()); | 8507 ASSERT(!HasStackOverflow()); |
8506 ASSERT(current_block() != NULL); | 8508 ASSERT(current_block() != NULL); |
8507 ASSERT(current_block()->HasPredecessor()); | 8509 ASSERT(current_block()->HasPredecessor()); |
8508 switch (expr->op()) { | 8510 switch (expr->op()) { |
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10197 } | 10199 } |
10198 } | 10200 } |
10199 | 10201 |
10200 #ifdef DEBUG | 10202 #ifdef DEBUG |
10201 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10203 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
10202 if (allocator_ != NULL) allocator_->Verify(); | 10204 if (allocator_ != NULL) allocator_->Verify(); |
10203 #endif | 10205 #endif |
10204 } | 10206 } |
10205 | 10207 |
10206 } } // namespace v8::internal | 10208 } } // namespace v8::internal |
OLD | NEW |