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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 1163143005: Fix uninitialized variable compiler errors [GCC 4.8.4] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 Handle<Object> object, 54 Handle<Object> object,
55 Handle<Object> key) { 55 Handle<Object> key) {
56 if (object->IsUndefined() || object->IsNull()) { 56 if (object->IsUndefined() || object->IsNull()) {
57 THROW_NEW_ERROR( 57 THROW_NEW_ERROR(
58 isolate, 58 isolate,
59 NewTypeError(MessageTemplate::kNonObjectPropertyLoad, key, object), 59 NewTypeError(MessageTemplate::kNonObjectPropertyLoad, key, object),
60 Object); 60 Object);
61 } 61 }
62 62
63 // Check if the given key is an array index. 63 // Check if the given key is an array index.
64 uint32_t index; 64 uint32_t index = 0;
65 if (key->ToArrayIndex(&index)) { 65 if (key->ToArrayIndex(&index)) {
66 return GetElementOrCharAt(isolate, object, index); 66 return GetElementOrCharAt(isolate, object, index);
67 } 67 }
68 68
69 // Convert the key to a name - possibly by calling back into JavaScript. 69 // Convert the key to a name - possibly by calling back into JavaScript.
70 Handle<Name> name; 70 Handle<Name> name;
71 ASSIGN_RETURN_ON_EXCEPTION(isolate, name, ToName(isolate, key), Object); 71 ASSIGN_RETURN_ON_EXCEPTION(isolate, name, ToName(isolate, key), Object);
72 72
73 // Check if the name is trivially convertible to an index and get 73 // Check if the name is trivially convertible to an index and get
74 // the element if so. 74 // the element if so.
(...skipping 24 matching lines...) Expand all
99 } else { 99 } else {
100 ASSIGN_RETURN_ON_EXCEPTION(isolate, name_object, 100 ASSIGN_RETURN_ON_EXCEPTION(isolate, name_object,
101 Execution::ToString(isolate, key), Object); 101 Execution::ToString(isolate, key), Object);
102 } 102 }
103 Handle<Name> name = Handle<Name>::cast(name_object); 103 Handle<Name> name = Handle<Name>::cast(name_object);
104 return Object::SetProperty(Handle<JSProxy>::cast(object), name, value, 104 return Object::SetProperty(Handle<JSProxy>::cast(object), name, value,
105 language_mode); 105 language_mode);
106 } 106 }
107 107
108 // Check if the given key is an array index. 108 // Check if the given key is an array index.
109 uint32_t index; 109 uint32_t index = 0;
110 if (key->ToArrayIndex(&index)) { 110 if (key->ToArrayIndex(&index)) {
111 // TODO(verwaest): Support non-JSObject receivers. 111 // TODO(verwaest): Support non-JSObject receivers.
112 if (!object->IsJSObject()) return value; 112 if (!object->IsJSObject()) return value;
113 Handle<JSObject> js_object = Handle<JSObject>::cast(object); 113 Handle<JSObject> js_object = Handle<JSObject>::cast(object);
114 114
115 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters 115 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters
116 // of a string using [] notation. We need to support this too in 116 // of a string using [] notation. We need to support this too in
117 // JavaScript. 117 // JavaScript.
118 // In the case of a String object we just need to redirect the assignment to 118 // In the case of a String object we just need to redirect the assignment to
119 // the underlying string if the index is in range. Since the underlying 119 // the underlying string if the index is in range. Since the underlying
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return Object::SetProperty(object, name, value, language_mode); 175 return Object::SetProperty(object, name, value, language_mode);
176 } 176 }
177 177
178 178
179 MaybeHandle<Object> Runtime::DefineObjectProperty(Handle<JSObject> js_object, 179 MaybeHandle<Object> Runtime::DefineObjectProperty(Handle<JSObject> js_object,
180 Handle<Object> key, 180 Handle<Object> key,
181 Handle<Object> value, 181 Handle<Object> value,
182 PropertyAttributes attrs) { 182 PropertyAttributes attrs) {
183 Isolate* isolate = js_object->GetIsolate(); 183 Isolate* isolate = js_object->GetIsolate();
184 // Check if the given key is an array index. 184 // Check if the given key is an array index.
185 uint32_t index; 185 uint32_t index = 0;
186 if (key->ToArrayIndex(&index)) { 186 if (key->ToArrayIndex(&index)) {
187 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters 187 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters
188 // of a string using [] notation. We need to support this too in 188 // of a string using [] notation. We need to support this too in
189 // JavaScript. 189 // JavaScript.
190 // In the case of a String object we just need to redirect the assignment to 190 // In the case of a String object we just need to redirect the assignment to
191 // the underlying string if the index is in range. Since the underlying 191 // the underlying string if the index is in range. Since the underlying
192 // string does nothing with the assignment then we can ignore such 192 // string does nothing with the assignment then we can ignore such
193 // assignments. 193 // assignments.
194 if (js_object->IsStringObjectWithCharacterAt(index)) { 194 if (js_object->IsStringObjectWithCharacterAt(index)) {
195 return value; 195 return value;
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); 1542 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
1543 1543
1544 RETURN_FAILURE_ON_EXCEPTION( 1544 RETURN_FAILURE_ON_EXCEPTION(
1545 isolate, 1545 isolate,
1546 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), 1546 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
1547 setter, attrs)); 1547 setter, attrs));
1548 return isolate->heap()->undefined_value(); 1548 return isolate->heap()->undefined_value();
1549 } 1549 }
1550 } // namespace internal 1550 } // namespace internal
1551 } // namespace v8 1551 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698