| 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 6334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6345 | 6345 |
| 6346 } else if (expr->key()->IsPropertyName()) { | 6346 } else if (expr->key()->IsPropertyName()) { |
| 6347 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); | 6347 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); |
| 6348 SmallMapList* types = expr->GetReceiverTypes(); | 6348 SmallMapList* types = expr->GetReceiverTypes(); |
| 6349 | 6349 |
| 6350 if (expr->IsMonomorphic()) { | 6350 if (expr->IsMonomorphic()) { |
| 6351 Handle<Map> map = types->first(); | 6351 Handle<Map> map = types->first(); |
| 6352 Handle<AccessorPair> accessors; | 6352 Handle<AccessorPair> accessors; |
| 6353 Handle<JSObject> holder; | 6353 Handle<JSObject> holder; |
| 6354 if (LookupAccessorPair(map, name, &accessors, &holder)) { | 6354 if (LookupAccessorPair(map, name, &accessors, &holder)) { |
| 6355 instr = BuildCallGetter(Pop(), map, accessors, holder); | 6355 AddCheckConstantFunction(holder, Top(), map, true); |
| 6356 Handle<JSFunction> getter(JSFunction::cast(accessors->getter())); |
| 6357 if (FLAG_inline_accessors && TryInlineGetter(getter, expr)) return; |
| 6358 AddInstruction(new(zone()) HPushArgument(Pop())); |
| 6359 instr = new(zone()) HCallConstantFunction(getter, 1); |
| 6356 } else { | 6360 } else { |
| 6357 instr = BuildLoadNamedMonomorphic(Pop(), name, expr, map); | 6361 instr = BuildLoadNamedMonomorphic(Pop(), name, expr, map); |
| 6358 } | 6362 } |
| 6359 } else if (types != NULL && types->length() > 1) { | 6363 } else if (types != NULL && types->length() > 1) { |
| 6360 return HandlePolymorphicLoadNamedField(expr, Pop(), types, name); | 6364 return HandlePolymorphicLoadNamedField(expr, Pop(), types, name); |
| 6361 } else { | 6365 } else { |
| 6362 instr = BuildLoadNamedGeneric(Pop(), name, expr); | 6366 instr = BuildLoadNamedGeneric(Pop(), name, expr); |
| 6363 } | 6367 } |
| 6364 | 6368 |
| 6365 } else { | 6369 } else { |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6913 return TryInline(CALL_AS_FUNCTION, | 6917 return TryInline(CALL_AS_FUNCTION, |
| 6914 expr->target(), | 6918 expr->target(), |
| 6915 expr->arguments()->length(), | 6919 expr->arguments()->length(), |
| 6916 receiver, | 6920 receiver, |
| 6917 expr->id(), | 6921 expr->id(), |
| 6918 expr->ReturnId(), | 6922 expr->ReturnId(), |
| 6919 CONSTRUCT_CALL_RETURN); | 6923 CONSTRUCT_CALL_RETURN); |
| 6920 } | 6924 } |
| 6921 | 6925 |
| 6922 | 6926 |
| 6927 bool HGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, |
| 6928 Property* prop) { |
| 6929 return TryInline(CALL_AS_METHOD, |
| 6930 getter, |
| 6931 0, |
| 6932 NULL, |
| 6933 prop->id(), |
| 6934 prop->ReturnId(), |
| 6935 NORMAL_RETURN); |
| 6936 } |
| 6937 |
| 6938 |
| 6923 bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) { | 6939 bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) { |
| 6924 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; | 6940 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; |
| 6925 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); | 6941 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); |
| 6926 switch (id) { | 6942 switch (id) { |
| 6927 case kMathRound: | 6943 case kMathRound: |
| 6928 case kMathAbs: | 6944 case kMathAbs: |
| 6929 case kMathSqrt: | 6945 case kMathSqrt: |
| 6930 case kMathLog: | 6946 case kMathLog: |
| 6931 case kMathSin: | 6947 case kMathSin: |
| 6932 case kMathCos: | 6948 case kMathCos: |
| (...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9643 } | 9659 } |
| 9644 } | 9660 } |
| 9645 | 9661 |
| 9646 #ifdef DEBUG | 9662 #ifdef DEBUG |
| 9647 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9663 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 9648 if (allocator_ != NULL) allocator_->Verify(); | 9664 if (allocator_ != NULL) allocator_->Verify(); |
| 9649 #endif | 9665 #endif |
| 9650 } | 9666 } |
| 9651 | 9667 |
| 9652 } } // namespace v8::internal | 9668 } } // namespace v8::internal |
| OLD | NEW |