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

Side by Side Diff: src/objects.cc

Issue 10910093: Merged r12434, r12435, r12440, r12441, r12443, r12444, r12445, r12446 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 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 | « src/isolate.cc ('k') | src/version.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 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (IsJSReceiver()) { 134 if (IsJSReceiver()) {
135 holder = this; 135 holder = this;
136 } else { 136 } else {
137 Context* native_context = Isolate::Current()->context()->native_context(); 137 Context* native_context = Isolate::Current()->context()->native_context();
138 if (IsNumber()) { 138 if (IsNumber()) {
139 holder = native_context->number_function()->instance_prototype(); 139 holder = native_context->number_function()->instance_prototype();
140 } else if (IsString()) { 140 } else if (IsString()) {
141 holder = native_context->string_function()->instance_prototype(); 141 holder = native_context->string_function()->instance_prototype();
142 } else if (IsBoolean()) { 142 } else if (IsBoolean()) {
143 holder = native_context->boolean_function()->instance_prototype(); 143 holder = native_context->boolean_function()->instance_prototype();
144 } else {
145 Isolate::Current()->PushStackTraceAndDie(
146 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001);
144 } 147 }
145 } 148 }
146 ASSERT(holder != NULL); // Cannot handle null or undefined. 149 ASSERT(holder != NULL); // Cannot handle null or undefined.
147 JSReceiver::cast(holder)->Lookup(name, result); 150 JSReceiver::cast(holder)->Lookup(name, result);
148 } 151 }
149 152
150 153
151 MaybeObject* Object::GetPropertyWithReceiver(Object* receiver, 154 MaybeObject* Object::GetPropertyWithReceiver(Object* receiver,
152 String* name, 155 String* name,
153 PropertyAttributes* attributes) { 156 PropertyAttributes* attributes) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 v8::Handle<v8::Value> result; 203 v8::Handle<v8::Value> result;
201 { 204 {
202 // Leaving JavaScript. 205 // Leaving JavaScript.
203 VMState state(isolate, EXTERNAL); 206 VMState state(isolate, EXTERNAL);
204 result = call_fun(v8::Utils::ToLocal(key), info); 207 result = call_fun(v8::Utils::ToLocal(key), info);
205 } 208 }
206 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 209 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
207 if (result.IsEmpty()) { 210 if (result.IsEmpty()) {
208 return isolate->heap()->undefined_value(); 211 return isolate->heap()->undefined_value();
209 } 212 }
210 return *v8::Utils::OpenHandle(*result); 213 Object* return_value = *v8::Utils::OpenHandle(*result);
214 #if ENABLE_EXTRA_CHECKS
215 if (!(return_value->IsSmi() ||
216 return_value->IsString() ||
217 return_value->IsSpecObject() ||
218 return_value->IsHeapNumber() ||
219 return_value->IsUndefined() ||
220 return_value->IsTrue() ||
221 return_value->IsFalse() ||
222 return_value->IsNull())) {
223 FATAL("API call returned invalid object");
224 }
225 #endif
226 return return_value;
211 } 227 }
212 228
213 // __defineGetter__ callback 229 // __defineGetter__ callback
214 if (structure->IsAccessorPair()) { 230 if (structure->IsAccessorPair()) {
215 Object* getter = AccessorPair::cast(structure)->getter(); 231 Object* getter = AccessorPair::cast(structure)->getter();
216 if (getter->IsSpecFunction()) { 232 if (getter->IsSpecFunction()) {
217 // TODO(rossberg): nicer would be to cast to some JSCallable here... 233 // TODO(rossberg): nicer would be to cast to some JSCallable here...
218 return GetPropertyWithDefinedGetter(receiver, JSReceiver::cast(getter)); 234 return GetPropertyWithDefinedGetter(receiver, JSReceiver::cast(getter));
219 } 235 }
220 // Getter is not a function. 236 // Getter is not a function.
(...skipping 12943 matching lines...) Expand 10 before | Expand all | Expand 10 after
13164 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13180 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13165 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13181 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13166 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13182 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13167 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13183 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13168 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13184 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13169 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13185 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13170 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13186 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13171 } 13187 }
13172 13188
13173 } } // namespace v8::internal 13189 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698