OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 7023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7034 ASSERT(current_block() != NULL); | 7034 ASSERT(current_block() != NULL); |
7035 ASSERT(current_block()->HasPredecessor()); | 7035 ASSERT(current_block()->HasPredecessor()); |
7036 Expression* callee = expr->expression(); | 7036 Expression* callee = expr->expression(); |
7037 int argument_count = expr->arguments()->length() + 1; // Plus receiver. | 7037 int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
7038 HInstruction* call = NULL; | 7038 HInstruction* call = NULL; |
7039 | 7039 |
7040 Property* prop = callee->AsProperty(); | 7040 Property* prop = callee->AsProperty(); |
7041 if (prop != NULL) { | 7041 if (prop != NULL) { |
7042 if (!prop->key()->IsPropertyName()) { | 7042 if (!prop->key()->IsPropertyName()) { |
7043 // Keyed function call. | 7043 // Keyed function call. |
7044 CHECK_ALIVE(VisitArgument(prop->obj())); | 7044 CHECK_ALIVE(VisitForValue(prop->obj())); |
| 7045 CHECK_ALIVE(VisitForValue(prop->key())); |
7045 | 7046 |
7046 CHECK_ALIVE(VisitForValue(prop->key())); | |
7047 // Push receiver and key like the non-optimized code generator expects it. | 7047 // Push receiver and key like the non-optimized code generator expects it. |
7048 HValue* key = Pop(); | 7048 HValue* key = Pop(); |
7049 HValue* receiver = Pop(); | 7049 HValue* receiver = Pop(); |
7050 Push(key); | 7050 Push(key); |
7051 Push(receiver); | 7051 PushAndAdd(New<HPushArgument>(receiver)); |
7052 | |
7053 CHECK_ALIVE(VisitArgumentList(expr->arguments())); | 7052 CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
7054 | 7053 |
7055 HValue* context = environment()->context(); | 7054 if (expr->IsMonomorphic()) { |
7056 call = new(zone()) HCallKeyed(context, key, argument_count); | 7055 BuildCheckHeapObject(receiver); |
| 7056 ElementsKind kind = expr->KeyedArrayCallIsHoley() |
| 7057 ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS; |
| 7058 |
| 7059 Handle<Map> map(isolate()->get_initial_js_array_map(kind)); |
| 7060 |
| 7061 HValue* function = BuildMonomorphicElementAccess( |
| 7062 receiver, key, NULL, NULL, map, false, STANDARD_STORE); |
| 7063 |
| 7064 call = New<HCallFunction>(function, argument_count); |
| 7065 } else { |
| 7066 HValue* context = environment()->context(); |
| 7067 call = new(zone()) HCallKeyed(context, key, argument_count); |
| 7068 } |
7057 call->set_position(expr->position()); | 7069 call->set_position(expr->position()); |
7058 Drop(argument_count + 1); // 1 is the key. | 7070 Drop(argument_count + 1); // 1 is the key. |
7059 return ast_context()->ReturnInstruction(call, expr->id()); | 7071 return ast_context()->ReturnInstruction(call, expr->id()); |
7060 } | 7072 } |
7061 | 7073 |
7062 // Named function call. | 7074 // Named function call. |
7063 if (TryCallApply(expr)) return; | 7075 if (TryCallApply(expr)) return; |
7064 | 7076 |
7065 CHECK_ALIVE(VisitForValue(prop->obj())); | 7077 CHECK_ALIVE(VisitForValue(prop->obj())); |
7066 CHECK_ALIVE(VisitExpressions(expr->arguments())); | 7078 CHECK_ALIVE(VisitExpressions(expr->arguments())); |
(...skipping 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9907 if (ShouldProduceTraceOutput()) { | 9919 if (ShouldProduceTraceOutput()) { |
9908 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9920 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9909 } | 9921 } |
9910 | 9922 |
9911 #ifdef DEBUG | 9923 #ifdef DEBUG |
9912 graph_->Verify(false); // No full verify. | 9924 graph_->Verify(false); // No full verify. |
9913 #endif | 9925 #endif |
9914 } | 9926 } |
9915 | 9927 |
9916 } } // namespace v8::internal | 9928 } } // namespace v8::internal |
OLD | NEW |