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

Side by Side Diff: src/objects.cc

Issue 22901034: Simplify logic by extracting local lookup before the switch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months 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 | 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 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 4073 matching lines...) Expand 10 before | Expand all | Expand 10 after
4084 ASSERT(proto->IsJSGlobalObject()); 4084 ASSERT(proto->IsJSGlobalObject());
4085 return JSObject::cast(proto)->SetLocalPropertyIgnoreAttributes( 4085 return JSObject::cast(proto)->SetLocalPropertyIgnoreAttributes(
4086 name_raw, 4086 name_raw,
4087 value_raw, 4087 value_raw,
4088 attributes, 4088 attributes,
4089 value_type, 4089 value_type,
4090 mode, 4090 mode,
4091 extensibility_check); 4091 extensibility_check);
4092 } 4092 }
4093 4093
4094 if (lookup.IsFound() &&
4095 (lookup.type() == INTERCEPTOR || lookup.type() == CALLBACKS)) {
4096 LocalLookupRealNamedProperty(name_raw, &lookup);
4097 }
4098
4094 // Check for accessor in prototype chain removed here in clone. 4099 // Check for accessor in prototype chain removed here in clone.
4095 if (!lookup.IsFound()) { 4100 if (!lookup.IsFound()) {
4096 // Neither properties nor transitions found. 4101 // Neither properties nor transitions found.
4097 return AddProperty( 4102 return AddProperty(
4098 name_raw, value_raw, attributes, kNonStrictMode, 4103 name_raw, value_raw, attributes, kNonStrictMode,
4099 MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode); 4104 MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode);
4100 } 4105 }
4101 4106
4102 // From this point on everything needs to be handlified. 4107 // From this point on everything needs to be handlified.
4103 HandleScope scope(isolate); 4108 HandleScope scope(isolate);
(...skipping 21 matching lines...) Expand all
4125 break; 4130 break;
4126 case CONSTANT: 4131 case CONSTANT:
4127 // Only replace the constant if necessary. 4132 // Only replace the constant if necessary.
4128 if (lookup.GetAttributes() != attributes || 4133 if (lookup.GetAttributes() != attributes ||
4129 *value != lookup.GetConstant()) { 4134 *value != lookup.GetConstant()) {
4130 result = SetPropertyToFieldWithAttributes( 4135 result = SetPropertyToFieldWithAttributes(
4131 &lookup, name, value, attributes); 4136 &lookup, name, value, attributes);
4132 } 4137 }
4133 break; 4138 break;
4134 case CALLBACKS: 4139 case CALLBACKS:
4135 // Callbacks are not guaranteed to be installed on the receiver. Also 4140 result = ConvertAndSetLocalProperty(&lookup, *name, *value, attributes);
4136 // perform a local lookup again. Fall through.
4137 case INTERCEPTOR:
4138 self->LocalLookupRealNamedProperty(*name, &lookup);
4139 if (lookup.IsFound()) {
4140 if (lookup.IsPropertyCallbacks()) {
4141 result = ConvertAndSetLocalProperty(
4142 &lookup, *name, *value, attributes);
4143 } else if (lookup.IsNormal()) {
4144 result = self->ReplaceSlowProperty(*name, *value, attributes);
4145 } else {
4146 result = SetPropertyToFieldWithAttributes(
4147 &lookup, name, value, attributes);
4148 }
4149 } else {
4150 result = self->AddProperty(
4151 *name, *value, attributes, kNonStrictMode, MAY_BE_STORE_FROM_KEYED,
4152 extensibility_check, value_type, mode);
4153 }
4154 break; 4141 break;
4155 case TRANSITION: 4142 case TRANSITION:
4156 result = SetPropertyUsingTransition(&lookup, name, value, attributes); 4143 result = SetPropertyUsingTransition(&lookup, name, value, attributes);
4157 break; 4144 break;
4145 case NONEXISTENT:
4158 case HANDLER: 4146 case HANDLER:
4159 case NONEXISTENT: 4147 case INTERCEPTOR:
4160 UNREACHABLE(); 4148 UNREACHABLE();
4161 } 4149 }
4162 4150
4163 Handle<Object> hresult; 4151 Handle<Object> hresult;
4164 if (!result->ToHandle(&hresult, isolate)) return result; 4152 if (!result->ToHandle(&hresult, isolate)) return result;
4165 4153
4166 if (is_observed) { 4154 if (is_observed) {
4167 if (lookup.IsTransition()) { 4155 if (lookup.IsTransition()) {
4168 EnqueueChangeRecord(self, "new", name, old_value); 4156 EnqueueChangeRecord(self, "new", name, old_value);
4169 } else if (old_value->IsTheHole()) { 4157 } else if (old_value->IsTheHole()) {
(...skipping 11839 matching lines...) Expand 10 before | Expand all | Expand 10 after
16009 #define ERROR_MESSAGES_TEXTS(C, T) T, 15997 #define ERROR_MESSAGES_TEXTS(C, T) T,
16010 static const char* error_messages_[] = { 15998 static const char* error_messages_[] = {
16011 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 15999 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16012 }; 16000 };
16013 #undef ERROR_MESSAGES_TEXTS 16001 #undef ERROR_MESSAGES_TEXTS
16014 return error_messages_[reason]; 16002 return error_messages_[reason];
16015 } 16003 }
16016 16004
16017 16005
16018 } } // namespace v8::internal 16006 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698