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

Side by Side Diff: src/api.cc

Issue 141044: A helper function to speed up creation of V8 wrappers for DOM Nodes. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 i::Handle<i::JSArray> obj = Utils::OpenHandle(this); 3005 i::Handle<i::JSArray> obj = Utils::OpenHandle(this);
3006 i::Object* length = obj->length(); 3006 i::Object* length = obj->length();
3007 if (length->IsSmi()) { 3007 if (length->IsSmi()) {
3008 return i::Smi::cast(length)->value(); 3008 return i::Smi::cast(length)->value();
3009 } else { 3009 } else {
3010 return static_cast<uint32_t>(length->Number()); 3010 return static_cast<uint32_t>(length->Number());
3011 } 3011 }
3012 } 3012 }
3013 3013
3014 3014
3015 Local<Object> Array::CloneElementAt(uint32_t index) {
3016 ON_BAILOUT("v8::Array::CloneElementAt()", return Local<Object>());
3017 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3018 if (!self->HasFastElements()) {
3019 return Local<Object>();
3020 }
3021 i::FixedArray* elms = self->elements();
3022 i::Object* paragon = elms->get(index);
3023 if (!paragon->IsJSObject()) {
3024 return Local<Object>();
3025 }
3026 i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon));
3027 EXCEPTION_PREAMBLE();
3028 i::Handle<i::JSObject> result = i::Copy(paragon_handle);
3029 has_pending_exception = result.is_null();
3030 EXCEPTION_BAILOUT_CHECK(Local<Object>());
3031 return Utils::ToLocal(result);
3032 }
3033
3034
3015 Local<String> v8::String::NewSymbol(const char* data, int length) { 3035 Local<String> v8::String::NewSymbol(const char* data, int length) {
3016 EnsureInitialized("v8::String::NewSymbol()"); 3036 EnsureInitialized("v8::String::NewSymbol()");
3017 LOG_API("String::NewSymbol(char)"); 3037 LOG_API("String::NewSymbol(char)");
3018 ENTER_V8; 3038 ENTER_V8;
3019 if (length == -1) length = strlen(data); 3039 if (length == -1) length = strlen(data);
3020 i::Handle<i::String> result = 3040 i::Handle<i::String> result =
3021 i::Factory::LookupSymbol(i::Vector<const char>(data, length)); 3041 i::Factory::LookupSymbol(i::Vector<const char>(data, length));
3022 return Utils::ToLocal(result); 3042 return Utils::ToLocal(result);
3023 } 3043 }
3024 3044
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
3505 reinterpret_cast<HandleScopeImplementer*>(storage); 3525 reinterpret_cast<HandleScopeImplementer*>(storage);
3506 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); 3526 List<void**>* blocks_of_archived_thread = thread_local->Blocks();
3507 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = 3527 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread =
3508 &thread_local->handle_scope_data_; 3528 &thread_local->handle_scope_data_;
3509 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); 3529 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread);
3510 3530
3511 return storage + ArchiveSpacePerThread(); 3531 return storage + ArchiveSpacePerThread();
3512 } 3532 }
3513 3533
3514 } } // namespace v8::internal 3534 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698