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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 v8::Handle<v8::Value> result; | 203 v8::Handle<v8::Value> result; |
204 { | 204 { |
205 // Leaving JavaScript. | 205 // Leaving JavaScript. |
206 VMState state(isolate, EXTERNAL); | 206 VMState state(isolate, EXTERNAL); |
207 result = call_fun(v8::Utils::ToLocal(key), info); | 207 result = call_fun(v8::Utils::ToLocal(key), info); |
208 } | 208 } |
209 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 209 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
210 if (result.IsEmpty()) { | 210 if (result.IsEmpty()) { |
211 return isolate->heap()->undefined_value(); | 211 return isolate->heap()->undefined_value(); |
212 } | 212 } |
213 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; |
214 } | 227 } |
215 | 228 |
216 // __defineGetter__ callback | 229 // __defineGetter__ callback |
217 if (structure->IsAccessorPair()) { | 230 if (structure->IsAccessorPair()) { |
218 Object* getter = AccessorPair::cast(structure)->getter(); | 231 Object* getter = AccessorPair::cast(structure)->getter(); |
219 if (getter->IsSpecFunction()) { | 232 if (getter->IsSpecFunction()) { |
220 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 233 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
221 return GetPropertyWithDefinedGetter(receiver, JSReceiver::cast(getter)); | 234 return GetPropertyWithDefinedGetter(receiver, JSReceiver::cast(getter)); |
222 } | 235 } |
223 // Getter is not a function. | 236 // Getter is not a function. |
(...skipping 12978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13202 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13215 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13203 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13216 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13204 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13217 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13205 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13218 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13206 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13219 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13207 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13220 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13208 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13221 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13209 } | 13222 } |
13210 | 13223 |
13211 } } // namespace v8::internal | 13224 } } // namespace v8::internal |
OLD | NEW |